@@ -18,68 +18,68 @@  | 
                                                    ||
| 18 | 18 | class ExitModal  | 
                                                        
| 19 | 19 |  { | 
                                                        
| 20 | 20 | |
| 21 | - /**  | 
                                                        |
| 22 | - * @var Registry  | 
                                                        |
| 23 | - */  | 
                                                        |
| 24 | - private $assets_registry;  | 
                                                        |
| 21 | + /**  | 
                                                        |
| 22 | + * @var Registry  | 
                                                        |
| 23 | + */  | 
                                                        |
| 24 | + private $assets_registry;  | 
                                                        |
| 25 | 25 | |
| 26 | - /**  | 
                                                        |
| 27 | - * ExitModal constructor.  | 
                                                        |
| 28 | - *  | 
                                                        |
| 29 | - * @param Registry $assets_registry  | 
                                                        |
| 30 | - */  | 
                                                        |
| 31 | - public function __construct(Registry $assets_registry)  | 
                                                        |
| 32 | -    { | 
                                                        |
| 33 | - $this->assets_registry = $assets_registry;  | 
                                                        |
| 34 | -        add_action('in_admin_footer', array($this, 'modalContainer')); | 
                                                        |
| 35 | -        add_action('admin_enqueue_scripts', array($this, 'enqueues')); | 
                                                        |
| 36 | - }  | 
                                                        |
| 26 | + /**  | 
                                                        |
| 27 | + * ExitModal constructor.  | 
                                                        |
| 28 | + *  | 
                                                        |
| 29 | + * @param Registry $assets_registry  | 
                                                        |
| 30 | + */  | 
                                                        |
| 31 | + public function __construct(Registry $assets_registry)  | 
                                                        |
| 32 | +	{ | 
                                                        |
| 33 | + $this->assets_registry = $assets_registry;  | 
                                                        |
| 34 | +		add_action('in_admin_footer', array($this, 'modalContainer')); | 
                                                        |
| 35 | +		add_action('admin_enqueue_scripts', array($this, 'enqueues')); | 
                                                        |
| 36 | + }  | 
                                                        |
| 37 | 37 | |
| 38 | 38 | |
| 39 | - /**  | 
                                                        |
| 40 | - * Callback on in_admin_footer that is used to output the exit modal container.  | 
                                                        |
| 41 | - */  | 
                                                        |
| 42 | - public function modalContainer()  | 
                                                        |
| 43 | -    { | 
                                                        |
| 44 | - echo '<div id="ee-exit-survey-modal"></div>';  | 
                                                        |
| 45 | - }  | 
                                                        |
| 39 | + /**  | 
                                                        |
| 40 | + * Callback on in_admin_footer that is used to output the exit modal container.  | 
                                                        |
| 41 | + */  | 
                                                        |
| 42 | + public function modalContainer()  | 
                                                        |
| 43 | +	{ | 
                                                        |
| 44 | + echo '<div id="ee-exit-survey-modal"></div>';  | 
                                                        |
| 45 | + }  | 
                                                        |
| 46 | 46 | |
| 47 | 47 | |
| 48 | - /**  | 
                                                        |
| 49 | - * Callback for `admin_enqueue_scripts` to take care of enqueueing scripts and styles specific to the modal.  | 
                                                        |
| 50 | - *  | 
                                                        |
| 51 | - * @throws InvalidArgumentException  | 
                                                        |
| 52 | - */  | 
                                                        |
| 53 | - public function enqueues()  | 
                                                        |
| 54 | -    { | 
                                                        |
| 55 | - $current_user = new WP_User(get_current_user_id());  | 
                                                        |
| 56 | - $this->assets_registry->addData(  | 
                                                        |
| 57 | - 'exitModalInfo',  | 
                                                        |
| 58 | - array(  | 
                                                        |
| 59 | - 'firstname' => htmlspecialchars($current_user->user_firstname),  | 
                                                        |
| 60 | - 'emailaddress' => htmlspecialchars($current_user->user_email),  | 
                                                        |
| 61 | - 'website' => htmlspecialchars(site_url()),  | 
                                                        |
| 62 | - 'isModalActive' => $this->isModalActive()  | 
                                                        |
| 63 | - )  | 
                                                        |
| 64 | - );  | 
                                                        |
| 48 | + /**  | 
                                                        |
| 49 | + * Callback for `admin_enqueue_scripts` to take care of enqueueing scripts and styles specific to the modal.  | 
                                                        |
| 50 | + *  | 
                                                        |
| 51 | + * @throws InvalidArgumentException  | 
                                                        |
| 52 | + */  | 
                                                        |
| 53 | + public function enqueues()  | 
                                                        |
| 54 | +	{ | 
                                                        |
| 55 | + $current_user = new WP_User(get_current_user_id());  | 
                                                        |
| 56 | + $this->assets_registry->addData(  | 
                                                        |
| 57 | + 'exitModalInfo',  | 
                                                        |
| 58 | + array(  | 
                                                        |
| 59 | + 'firstname' => htmlspecialchars($current_user->user_firstname),  | 
                                                        |
| 60 | + 'emailaddress' => htmlspecialchars($current_user->user_email),  | 
                                                        |
| 61 | + 'website' => htmlspecialchars(site_url()),  | 
                                                        |
| 62 | + 'isModalActive' => $this->isModalActive()  | 
                                                        |
| 63 | + )  | 
                                                        |
| 64 | + );  | 
                                                        |
| 65 | 65 | |
| 66 | -        wp_enqueue_script('ee-wp-plugins-page'); | 
                                                        |
| 67 | -        wp_enqueue_style('ee-wp-plugins-page'); | 
                                                        |
| 68 | - }  | 
                                                        |
| 66 | +		wp_enqueue_script('ee-wp-plugins-page'); | 
                                                        |
| 67 | +		wp_enqueue_style('ee-wp-plugins-page'); | 
                                                        |
| 68 | + }  | 
                                                        |
| 69 | 69 | |
| 70 | 70 | |
| 71 | - /**  | 
                                                        |
| 72 | - * Exposes a filter switch for turning off the enqueueing of the modal script.  | 
                                                        |
| 73 | - * @return bool  | 
                                                        |
| 74 | - */  | 
                                                        |
| 75 | - private function isModalActive()  | 
                                                        |
| 76 | -    { | 
                                                        |
| 77 | - return filter_var(  | 
                                                        |
| 78 | - apply_filters(  | 
                                                        |
| 79 | - 'FHEE__EventEspresso_core_domain_services_admin_ExitModal__isModalActive',  | 
                                                        |
| 80 | - true  | 
                                                        |
| 81 | - ),  | 
                                                        |
| 82 | - FILTER_VALIDATE_BOOLEAN  | 
                                                        |
| 83 | - );  | 
                                                        |
| 84 | - }  | 
                                                        |
| 71 | + /**  | 
                                                        |
| 72 | + * Exposes a filter switch for turning off the enqueueing of the modal script.  | 
                                                        |
| 73 | + * @return bool  | 
                                                        |
| 74 | + */  | 
                                                        |
| 75 | + private function isModalActive()  | 
                                                        |
| 76 | +	{ | 
                                                        |
| 77 | + return filter_var(  | 
                                                        |
| 78 | + apply_filters(  | 
                                                        |
| 79 | + 'FHEE__EventEspresso_core_domain_services_admin_ExitModal__isModalActive',  | 
                                                        |
| 80 | + true  | 
                                                        |
| 81 | + ),  | 
                                                        |
| 82 | + FILTER_VALIDATE_BOOLEAN  | 
                                                        |
| 83 | + );  | 
                                                        |
| 84 | + }  | 
                                                        |
| 85 | 85 | }  | 
                                                        
| 86 | 86 | \ No newline at end of file  | 
                                                        
@@ -14,228 +14,228 @@  | 
                                                    ||
| 14 | 14 | */  | 
                                                        
| 15 | 15 | class I18nRegistry  | 
                                                        
| 16 | 16 |  { | 
                                                        
| 17 | - /**  | 
                                                        |
| 18 | - * @var DomainInterface  | 
                                                        |
| 19 | - */  | 
                                                        |
| 20 | - private $domain;  | 
                                                        |
| 21 | -  | 
                                                        |
| 22 | - /**  | 
                                                        |
| 23 | - * Will hold all registered i18n scripts.  | 
                                                        |
| 24 | - *  | 
                                                        |
| 25 | - * @var array  | 
                                                        |
| 26 | - */  | 
                                                        |
| 27 | - private $registered_i18n = array();  | 
                                                        |
| 28 | -  | 
                                                        |
| 29 | -  | 
                                                        |
| 30 | - /**  | 
                                                        |
| 31 | - * Used to hold queued translations for the chunks loading in a view.  | 
                                                        |
| 32 | - *  | 
                                                        |
| 33 | - * @var array  | 
                                                        |
| 34 | - */  | 
                                                        |
| 35 | - private $queued_handle_translations = array();  | 
                                                        |
| 36 | -  | 
                                                        |
| 37 | -  | 
                                                        |
| 38 | - /**  | 
                                                        |
| 39 | - * Obtained from the generated json file from the all javascript using wp.i18n with a map of script handle names to  | 
                                                        |
| 40 | - * translation strings.  | 
                                                        |
| 41 | - *  | 
                                                        |
| 42 | - * @var array  | 
                                                        |
| 43 | - */  | 
                                                        |
| 44 | - private $i18n_map;  | 
                                                        |
| 45 | -  | 
                                                        |
| 46 | -  | 
                                                        |
| 47 | - /**  | 
                                                        |
| 48 | - * I18nRegistry constructor.  | 
                                                        |
| 49 | - *  | 
                                                        |
| 50 | - * @param array() $i18n_map An array of script handle names and the strings translated for those handles. If not  | 
                                                        |
| 51 | - * provided, the class will look for map in root of plugin with filename of  | 
                                                        |
| 52 | - * 'translation-map.json'.  | 
                                                        |
| 53 | - * @param DomainInterface $domain  | 
                                                        |
| 54 | - */  | 
                                                        |
| 55 | - public function __construct(array $i18n_map = array(), DomainInterface $domain)  | 
                                                        |
| 56 | -    { | 
                                                        |
| 57 | - $this->domain = $domain;  | 
                                                        |
| 58 | - $this->setI18nMap($i18n_map);  | 
                                                        |
| 59 | -        add_filter('print_scripts_array', array($this, 'queueI18n')); | 
                                                        |
| 60 | - }  | 
                                                        |
| 61 | -  | 
                                                        |
| 62 | -  | 
                                                        |
| 63 | - /**  | 
                                                        |
| 64 | - * Used to register a script that has i18n strings for its $handle  | 
                                                        |
| 65 | - *  | 
                                                        |
| 66 | - * @param string $handle The script handle reference.  | 
                                                        |
| 67 | - * @param string $domain The i18n domain for the strings.  | 
                                                        |
| 68 | - */  | 
                                                        |
| 69 | - public function registerScriptI18n($handle, $domain = 'event_espresso')  | 
                                                        |
| 70 | -    { | 
                                                        |
| 71 | - $this->registered_i18n[$handle] = $domain;  | 
                                                        |
| 72 | - }  | 
                                                        |
| 73 | -  | 
                                                        |
| 74 | -  | 
                                                        |
| 75 | -  | 
                                                        |
| 76 | - /**  | 
                                                        |
| 77 | - * Callback on print_scripts_array to listen for scripts enqueued and handle setting up the localized data.  | 
                                                        |
| 78 | - *  | 
                                                        |
| 79 | - * @param array $handles Array of registered script handles.  | 
                                                        |
| 80 | - * @return array  | 
                                                        |
| 81 | - */  | 
                                                        |
| 82 | - public function queueI18n(array $handles)  | 
                                                        |
| 83 | -    { | 
                                                        |
| 84 | -        if (empty($this->registered_i18n) || empty($this->i18n_map)) { | 
                                                        |
| 85 | - return $handles;  | 
                                                        |
| 86 | - }  | 
                                                        |
| 87 | -        foreach ($handles as $handle) { | 
                                                        |
| 88 | - $this->queueI18nTranslationsForHandle($handle);  | 
                                                        |
| 89 | - }  | 
                                                        |
| 90 | -        if ($this->queued_handle_translations) { | 
                                                        |
| 91 | -            foreach ($this->queued_handle_translations as $handle => $translations_for_domain) { | 
                                                        |
| 92 | - $this->registerInlineScript(  | 
                                                        |
| 93 | - $handle,  | 
                                                        |
| 94 | - $translations_for_domain['translations'],  | 
                                                        |
| 95 | - $translations_for_domain['domain']  | 
                                                        |
| 96 | - );  | 
                                                        |
| 97 | - }  | 
                                                        |
| 98 | - }  | 
                                                        |
| 99 | - return $handles;  | 
                                                        |
| 100 | - }  | 
                                                        |
| 101 | -  | 
                                                        |
| 102 | -  | 
                                                        |
| 103 | - /**  | 
                                                        |
| 104 | - * Registers inline script with translations for given handle and domain.  | 
                                                        |
| 105 | - *  | 
                                                        |
| 106 | - * @param string $handle Handle used to register javascript file containing translations.  | 
                                                        |
| 107 | - * @param array $translations Array of string translations.  | 
                                                        |
| 108 | - * @param string $domain Domain for translations. If left empty then strings are registered with the default  | 
                                                        |
| 109 | - * domain for the javascript.  | 
                                                        |
| 110 | - */  | 
                                                        |
| 111 | - private function registerInlineScript($handle, array $translations, $domain)  | 
                                                        |
| 112 | -    { | 
                                                        |
| 113 | - $script = $domain ?  | 
                                                        |
| 114 | - 'wp.i18n.setLocaleData( ' . wp_json_encode($translations) . ', ' . $domain . ' );' :  | 
                                                        |
| 115 | - 'wp.i18n.setLocaleData( ' . wp_json_encode($translations) . ' );';  | 
                                                        |
| 116 | - wp_add_inline_script($handle, $script, 'before');  | 
                                                        |
| 117 | - }  | 
                                                        |
| 118 | -  | 
                                                        |
| 119 | -  | 
                                                        |
| 120 | - /**  | 
                                                        |
| 121 | - * Queues up the translation strings for the given handle.  | 
                                                        |
| 122 | - *  | 
                                                        |
| 123 | - * @param string $handle The script handle being queued up.  | 
                                                        |
| 124 | - */  | 
                                                        |
| 125 | - private function queueI18nTranslationsForHandle($handle)  | 
                                                        |
| 126 | -    { | 
                                                        |
| 127 | -        if (isset($this->registered_i18n[$handle])) { | 
                                                        |
| 128 | - $domain = $this->registered_i18n[$handle];  | 
                                                        |
| 129 | - $translations = $this->getJedLocaleDataForDomainAndChunk($handle, $domain);  | 
                                                        |
| 130 | -            if (count($translations) > 1) { | 
                                                        |
| 131 | - $this->queued_handle_translations[$handle] = array(  | 
                                                        |
| 132 | - 'domain' => $domain,  | 
                                                        |
| 133 | - 'translations' => $translations,  | 
                                                        |
| 134 | - );  | 
                                                        |
| 135 | - }  | 
                                                        |
| 136 | - unset($this->registered_i18n[$handle]);  | 
                                                        |
| 137 | - }  | 
                                                        |
| 138 | - }  | 
                                                        |
| 139 | -  | 
                                                        |
| 140 | -  | 
                                                        |
| 141 | - /**  | 
                                                        |
| 142 | - * Sets the internal i18n_map property.  | 
                                                        |
| 143 | - * If $chunk_map is empty or not an array, will attempt to load a chunk map from a default named map.  | 
                                                        |
| 144 | - *  | 
                                                        |
| 145 | - * @param array $i18n_map If provided, an array of translation strings indexed by script handle names they  | 
                                                        |
| 146 | - * correspond to.  | 
                                                        |
| 147 | - */  | 
                                                        |
| 148 | - private function setI18nMap(array $i18n_map)  | 
                                                        |
| 149 | -    { | 
                                                        |
| 150 | -        if (empty($i18n_map)) { | 
                                                        |
| 151 | - $i18n_map = file_exists($this->domain->pluginPath() . 'translation-map.json')  | 
                                                        |
| 152 | - ? json_decode(  | 
                                                        |
| 153 | - file_get_contents($this->domain->pluginPath() . 'translation-map.json'),  | 
                                                        |
| 154 | - true  | 
                                                        |
| 155 | - )  | 
                                                        |
| 156 | - : array();  | 
                                                        |
| 157 | - }  | 
                                                        |
| 158 | - $this->i18n_map = $i18n_map;  | 
                                                        |
| 159 | - }  | 
                                                        |
| 160 | -  | 
                                                        |
| 161 | -  | 
                                                        |
| 162 | - /**  | 
                                                        |
| 163 | - * Get the jed locale data for a given $handle and domain  | 
                                                        |
| 164 | - *  | 
                                                        |
| 165 | - * @param string $handle The name for the script handle we want strings returned for.  | 
                                                        |
| 166 | - * @param string $domain The i18n domain.  | 
                                                        |
| 167 | - * @return array  | 
                                                        |
| 168 | - */  | 
                                                        |
| 169 | - protected function getJedLocaleDataForDomainAndChunk($handle, $domain)  | 
                                                        |
| 170 | -    { | 
                                                        |
| 171 | - $translations = $this->getJedLocaleData($domain);  | 
                                                        |
| 172 | - // get index for adding back after extracting strings for this $chunk.  | 
                                                        |
| 173 | - $index = $translations[''];  | 
                                                        |
| 174 | - $translations = $this->getLocaleDataMatchingMap(  | 
                                                        |
| 175 | - $this->getOriginalStringsForHandleFromMap($handle),  | 
                                                        |
| 176 | - $translations  | 
                                                        |
| 177 | - );  | 
                                                        |
| 178 | - $translations[''] = $index;  | 
                                                        |
| 179 | - return $translations;  | 
                                                        |
| 180 | - }  | 
                                                        |
| 181 | -  | 
                                                        |
| 182 | -  | 
                                                        |
| 183 | - /**  | 
                                                        |
| 184 | - * Get locale data for given strings from given translations  | 
                                                        |
| 185 | - *  | 
                                                        |
| 186 | - * @param array $string_set This is the subset of strings (msgIds) we want to extract from the translations array.  | 
                                                        |
| 187 | - * @param array $translations Translation data to extra strings from.  | 
                                                        |
| 188 | - * @return array  | 
                                                        |
| 189 | - */  | 
                                                        |
| 190 | - protected function getLocaleDataMatchingMap(array $string_set, array $translations)  | 
                                                        |
| 191 | -    { | 
                                                        |
| 192 | -        if (empty($string_set)) { | 
                                                        |
| 193 | - return array();  | 
                                                        |
| 194 | - }  | 
                                                        |
| 195 | - // some strings with quotes in them will break on the array_flip, so making sure quotes in the string are  | 
                                                        |
| 196 | - // slashed also filter falsey values.  | 
                                                        |
| 197 | - $string_set = array_unique(array_filter(wp_slash($string_set)));  | 
                                                        |
| 198 | - return array_intersect_key($translations, array_flip($string_set));  | 
                                                        |
| 199 | - }  | 
                                                        |
| 200 | -  | 
                                                        |
| 201 | -  | 
                                                        |
| 202 | - /**  | 
                                                        |
| 203 | - * Get original strings to translate for the given chunk from the map  | 
                                                        |
| 204 | - *  | 
                                                        |
| 205 | - * @param string $handle The script handle name to get strings from the map for.  | 
                                                        |
| 206 | - * @return array  | 
                                                        |
| 207 | - */  | 
                                                        |
| 208 | - protected function getOriginalStringsForHandleFromMap($handle)  | 
                                                        |
| 209 | -    { | 
                                                        |
| 210 | - return isset($this->i18n_map[$handle]) ? $this->i18n_map[$handle] : array();  | 
                                                        |
| 211 | - }  | 
                                                        |
| 212 | -  | 
                                                        |
| 213 | -  | 
                                                        |
| 214 | - /**  | 
                                                        |
| 215 | - * Returns Jed-formatted localization data.  | 
                                                        |
| 216 | - *  | 
                                                        |
| 217 | - * @param string $domain Translation domain.  | 
                                                        |
| 218 | - * @return array  | 
                                                        |
| 219 | - */  | 
                                                        |
| 220 | - private function getJedLocaleData($domain)  | 
                                                        |
| 221 | -    { | 
                                                        |
| 222 | - $translations = get_translations_for_domain($domain);  | 
                                                        |
| 223 | -  | 
                                                        |
| 224 | - $locale = array(  | 
                                                        |
| 225 | - '' => array(  | 
                                                        |
| 226 | - 'domain' => $domain,  | 
                                                        |
| 227 | - 'lang' => is_admin() ? get_user_locale() : get_locale(),  | 
                                                        |
| 228 | - ),  | 
                                                        |
| 229 | - );  | 
                                                        |
| 230 | -  | 
                                                        |
| 231 | -        if (! empty($translations->headers['Plural-Forms'])) { | 
                                                        |
| 232 | - $locale['']['plural_forms'] = $translations->headers['Plural-Forms'];  | 
                                                        |
| 233 | - }  | 
                                                        |
| 234 | -  | 
                                                        |
| 235 | -        foreach ($translations->entries as $msgid => $entry) { | 
                                                        |
| 236 | - $locale[$msgid] = $entry->translations;  | 
                                                        |
| 237 | - }  | 
                                                        |
| 238 | -  | 
                                                        |
| 239 | - return $locale;  | 
                                                        |
| 240 | - }  | 
                                                        |
| 17 | + /**  | 
                                                        |
| 18 | + * @var DomainInterface  | 
                                                        |
| 19 | + */  | 
                                                        |
| 20 | + private $domain;  | 
                                                        |
| 21 | +  | 
                                                        |
| 22 | + /**  | 
                                                        |
| 23 | + * Will hold all registered i18n scripts.  | 
                                                        |
| 24 | + *  | 
                                                        |
| 25 | + * @var array  | 
                                                        |
| 26 | + */  | 
                                                        |
| 27 | + private $registered_i18n = array();  | 
                                                        |
| 28 | +  | 
                                                        |
| 29 | +  | 
                                                        |
| 30 | + /**  | 
                                                        |
| 31 | + * Used to hold queued translations for the chunks loading in a view.  | 
                                                        |
| 32 | + *  | 
                                                        |
| 33 | + * @var array  | 
                                                        |
| 34 | + */  | 
                                                        |
| 35 | + private $queued_handle_translations = array();  | 
                                                        |
| 36 | +  | 
                                                        |
| 37 | +  | 
                                                        |
| 38 | + /**  | 
                                                        |
| 39 | + * Obtained from the generated json file from the all javascript using wp.i18n with a map of script handle names to  | 
                                                        |
| 40 | + * translation strings.  | 
                                                        |
| 41 | + *  | 
                                                        |
| 42 | + * @var array  | 
                                                        |
| 43 | + */  | 
                                                        |
| 44 | + private $i18n_map;  | 
                                                        |
| 45 | +  | 
                                                        |
| 46 | +  | 
                                                        |
| 47 | + /**  | 
                                                        |
| 48 | + * I18nRegistry constructor.  | 
                                                        |
| 49 | + *  | 
                                                        |
| 50 | + * @param array() $i18n_map An array of script handle names and the strings translated for those handles. If not  | 
                                                        |
| 51 | + * provided, the class will look for map in root of plugin with filename of  | 
                                                        |
| 52 | + * 'translation-map.json'.  | 
                                                        |
| 53 | + * @param DomainInterface $domain  | 
                                                        |
| 54 | + */  | 
                                                        |
| 55 | + public function __construct(array $i18n_map = array(), DomainInterface $domain)  | 
                                                        |
| 56 | +	{ | 
                                                        |
| 57 | + $this->domain = $domain;  | 
                                                        |
| 58 | + $this->setI18nMap($i18n_map);  | 
                                                        |
| 59 | +		add_filter('print_scripts_array', array($this, 'queueI18n')); | 
                                                        |
| 60 | + }  | 
                                                        |
| 61 | +  | 
                                                        |
| 62 | +  | 
                                                        |
| 63 | + /**  | 
                                                        |
| 64 | + * Used to register a script that has i18n strings for its $handle  | 
                                                        |
| 65 | + *  | 
                                                        |
| 66 | + * @param string $handle The script handle reference.  | 
                                                        |
| 67 | + * @param string $domain The i18n domain for the strings.  | 
                                                        |
| 68 | + */  | 
                                                        |
| 69 | + public function registerScriptI18n($handle, $domain = 'event_espresso')  | 
                                                        |
| 70 | +	{ | 
                                                        |
| 71 | + $this->registered_i18n[$handle] = $domain;  | 
                                                        |
| 72 | + }  | 
                                                        |
| 73 | +  | 
                                                        |
| 74 | +  | 
                                                        |
| 75 | +  | 
                                                        |
| 76 | + /**  | 
                                                        |
| 77 | + * Callback on print_scripts_array to listen for scripts enqueued and handle setting up the localized data.  | 
                                                        |
| 78 | + *  | 
                                                        |
| 79 | + * @param array $handles Array of registered script handles.  | 
                                                        |
| 80 | + * @return array  | 
                                                        |
| 81 | + */  | 
                                                        |
| 82 | + public function queueI18n(array $handles)  | 
                                                        |
| 83 | +	{ | 
                                                        |
| 84 | +		if (empty($this->registered_i18n) || empty($this->i18n_map)) { | 
                                                        |
| 85 | + return $handles;  | 
                                                        |
| 86 | + }  | 
                                                        |
| 87 | +		foreach ($handles as $handle) { | 
                                                        |
| 88 | + $this->queueI18nTranslationsForHandle($handle);  | 
                                                        |
| 89 | + }  | 
                                                        |
| 90 | +		if ($this->queued_handle_translations) { | 
                                                        |
| 91 | +			foreach ($this->queued_handle_translations as $handle => $translations_for_domain) { | 
                                                        |
| 92 | + $this->registerInlineScript(  | 
                                                        |
| 93 | + $handle,  | 
                                                        |
| 94 | + $translations_for_domain['translations'],  | 
                                                        |
| 95 | + $translations_for_domain['domain']  | 
                                                        |
| 96 | + );  | 
                                                        |
| 97 | + }  | 
                                                        |
| 98 | + }  | 
                                                        |
| 99 | + return $handles;  | 
                                                        |
| 100 | + }  | 
                                                        |
| 101 | +  | 
                                                        |
| 102 | +  | 
                                                        |
| 103 | + /**  | 
                                                        |
| 104 | + * Registers inline script with translations for given handle and domain.  | 
                                                        |
| 105 | + *  | 
                                                        |
| 106 | + * @param string $handle Handle used to register javascript file containing translations.  | 
                                                        |
| 107 | + * @param array $translations Array of string translations.  | 
                                                        |
| 108 | + * @param string $domain Domain for translations. If left empty then strings are registered with the default  | 
                                                        |
| 109 | + * domain for the javascript.  | 
                                                        |
| 110 | + */  | 
                                                        |
| 111 | + private function registerInlineScript($handle, array $translations, $domain)  | 
                                                        |
| 112 | +	{ | 
                                                        |
| 113 | + $script = $domain ?  | 
                                                        |
| 114 | + 'wp.i18n.setLocaleData( ' . wp_json_encode($translations) . ', ' . $domain . ' );' :  | 
                                                        |
| 115 | + 'wp.i18n.setLocaleData( ' . wp_json_encode($translations) . ' );';  | 
                                                        |
| 116 | + wp_add_inline_script($handle, $script, 'before');  | 
                                                        |
| 117 | + }  | 
                                                        |
| 118 | +  | 
                                                        |
| 119 | +  | 
                                                        |
| 120 | + /**  | 
                                                        |
| 121 | + * Queues up the translation strings for the given handle.  | 
                                                        |
| 122 | + *  | 
                                                        |
| 123 | + * @param string $handle The script handle being queued up.  | 
                                                        |
| 124 | + */  | 
                                                        |
| 125 | + private function queueI18nTranslationsForHandle($handle)  | 
                                                        |
| 126 | +	{ | 
                                                        |
| 127 | +		if (isset($this->registered_i18n[$handle])) { | 
                                                        |
| 128 | + $domain = $this->registered_i18n[$handle];  | 
                                                        |
| 129 | + $translations = $this->getJedLocaleDataForDomainAndChunk($handle, $domain);  | 
                                                        |
| 130 | +			if (count($translations) > 1) { | 
                                                        |
| 131 | + $this->queued_handle_translations[$handle] = array(  | 
                                                        |
| 132 | + 'domain' => $domain,  | 
                                                        |
| 133 | + 'translations' => $translations,  | 
                                                        |
| 134 | + );  | 
                                                        |
| 135 | + }  | 
                                                        |
| 136 | + unset($this->registered_i18n[$handle]);  | 
                                                        |
| 137 | + }  | 
                                                        |
| 138 | + }  | 
                                                        |
| 139 | +  | 
                                                        |
| 140 | +  | 
                                                        |
| 141 | + /**  | 
                                                        |
| 142 | + * Sets the internal i18n_map property.  | 
                                                        |
| 143 | + * If $chunk_map is empty or not an array, will attempt to load a chunk map from a default named map.  | 
                                                        |
| 144 | + *  | 
                                                        |
| 145 | + * @param array $i18n_map If provided, an array of translation strings indexed by script handle names they  | 
                                                        |
| 146 | + * correspond to.  | 
                                                        |
| 147 | + */  | 
                                                        |
| 148 | + private function setI18nMap(array $i18n_map)  | 
                                                        |
| 149 | +	{ | 
                                                        |
| 150 | +		if (empty($i18n_map)) { | 
                                                        |
| 151 | + $i18n_map = file_exists($this->domain->pluginPath() . 'translation-map.json')  | 
                                                        |
| 152 | + ? json_decode(  | 
                                                        |
| 153 | + file_get_contents($this->domain->pluginPath() . 'translation-map.json'),  | 
                                                        |
| 154 | + true  | 
                                                        |
| 155 | + )  | 
                                                        |
| 156 | + : array();  | 
                                                        |
| 157 | + }  | 
                                                        |
| 158 | + $this->i18n_map = $i18n_map;  | 
                                                        |
| 159 | + }  | 
                                                        |
| 160 | +  | 
                                                        |
| 161 | +  | 
                                                        |
| 162 | + /**  | 
                                                        |
| 163 | + * Get the jed locale data for a given $handle and domain  | 
                                                        |
| 164 | + *  | 
                                                        |
| 165 | + * @param string $handle The name for the script handle we want strings returned for.  | 
                                                        |
| 166 | + * @param string $domain The i18n domain.  | 
                                                        |
| 167 | + * @return array  | 
                                                        |
| 168 | + */  | 
                                                        |
| 169 | + protected function getJedLocaleDataForDomainAndChunk($handle, $domain)  | 
                                                        |
| 170 | +	{ | 
                                                        |
| 171 | + $translations = $this->getJedLocaleData($domain);  | 
                                                        |
| 172 | + // get index for adding back after extracting strings for this $chunk.  | 
                                                        |
| 173 | + $index = $translations[''];  | 
                                                        |
| 174 | + $translations = $this->getLocaleDataMatchingMap(  | 
                                                        |
| 175 | + $this->getOriginalStringsForHandleFromMap($handle),  | 
                                                        |
| 176 | + $translations  | 
                                                        |
| 177 | + );  | 
                                                        |
| 178 | + $translations[''] = $index;  | 
                                                        |
| 179 | + return $translations;  | 
                                                        |
| 180 | + }  | 
                                                        |
| 181 | +  | 
                                                        |
| 182 | +  | 
                                                        |
| 183 | + /**  | 
                                                        |
| 184 | + * Get locale data for given strings from given translations  | 
                                                        |
| 185 | + *  | 
                                                        |
| 186 | + * @param array $string_set This is the subset of strings (msgIds) we want to extract from the translations array.  | 
                                                        |
| 187 | + * @param array $translations Translation data to extra strings from.  | 
                                                        |
| 188 | + * @return array  | 
                                                        |
| 189 | + */  | 
                                                        |
| 190 | + protected function getLocaleDataMatchingMap(array $string_set, array $translations)  | 
                                                        |
| 191 | +	{ | 
                                                        |
| 192 | +		if (empty($string_set)) { | 
                                                        |
| 193 | + return array();  | 
                                                        |
| 194 | + }  | 
                                                        |
| 195 | + // some strings with quotes in them will break on the array_flip, so making sure quotes in the string are  | 
                                                        |
| 196 | + // slashed also filter falsey values.  | 
                                                        |
| 197 | + $string_set = array_unique(array_filter(wp_slash($string_set)));  | 
                                                        |
| 198 | + return array_intersect_key($translations, array_flip($string_set));  | 
                                                        |
| 199 | + }  | 
                                                        |
| 200 | +  | 
                                                        |
| 201 | +  | 
                                                        |
| 202 | + /**  | 
                                                        |
| 203 | + * Get original strings to translate for the given chunk from the map  | 
                                                        |
| 204 | + *  | 
                                                        |
| 205 | + * @param string $handle The script handle name to get strings from the map for.  | 
                                                        |
| 206 | + * @return array  | 
                                                        |
| 207 | + */  | 
                                                        |
| 208 | + protected function getOriginalStringsForHandleFromMap($handle)  | 
                                                        |
| 209 | +	{ | 
                                                        |
| 210 | + return isset($this->i18n_map[$handle]) ? $this->i18n_map[$handle] : array();  | 
                                                        |
| 211 | + }  | 
                                                        |
| 212 | +  | 
                                                        |
| 213 | +  | 
                                                        |
| 214 | + /**  | 
                                                        |
| 215 | + * Returns Jed-formatted localization data.  | 
                                                        |
| 216 | + *  | 
                                                        |
| 217 | + * @param string $domain Translation domain.  | 
                                                        |
| 218 | + * @return array  | 
                                                        |
| 219 | + */  | 
                                                        |
| 220 | + private function getJedLocaleData($domain)  | 
                                                        |
| 221 | +	{ | 
                                                        |
| 222 | + $translations = get_translations_for_domain($domain);  | 
                                                        |
| 223 | +  | 
                                                        |
| 224 | + $locale = array(  | 
                                                        |
| 225 | + '' => array(  | 
                                                        |
| 226 | + 'domain' => $domain,  | 
                                                        |
| 227 | + 'lang' => is_admin() ? get_user_locale() : get_locale(),  | 
                                                        |
| 228 | + ),  | 
                                                        |
| 229 | + );  | 
                                                        |
| 230 | +  | 
                                                        |
| 231 | +		if (! empty($translations->headers['Plural-Forms'])) { | 
                                                        |
| 232 | + $locale['']['plural_forms'] = $translations->headers['Plural-Forms'];  | 
                                                        |
| 233 | + }  | 
                                                        |
| 234 | +  | 
                                                        |
| 235 | +		foreach ($translations->entries as $msgid => $entry) { | 
                                                        |
| 236 | + $locale[$msgid] = $entry->translations;  | 
                                                        |
| 237 | + }  | 
                                                        |
| 238 | +  | 
                                                        |
| 239 | + return $locale;  | 
                                                        |
| 240 | + }  | 
                                                        |
| 241 | 241 | }  | 
                                                        
| 242 | 242 | \ No newline at end of file  | 
                                                        
@@ -111,8 +111,7 @@ discard block  | 
                                                    ||
| 111 | 111 | private function registerInlineScript($handle, array $translations, $domain)  | 
                                                        
| 112 | 112 |      { | 
                                                        
| 113 | 113 | $script = $domain ?  | 
                                                        
| 114 | - 'wp.i18n.setLocaleData( ' . wp_json_encode($translations) . ', ' . $domain . ' );' :  | 
                                                        |
| 115 | - 'wp.i18n.setLocaleData( ' . wp_json_encode($translations) . ' );';  | 
                                                        |
| 114 | + 'wp.i18n.setLocaleData( '.wp_json_encode($translations).', '.$domain.' );' : 'wp.i18n.setLocaleData( '.wp_json_encode($translations).' );';  | 
                                                        |
| 116 | 115 | wp_add_inline_script($handle, $script, 'before');  | 
                                                        
| 117 | 116 | }  | 
                                                        
| 118 | 117 | |
@@ -148,9 +147,9 @@ discard block  | 
                                                    ||
| 148 | 147 | private function setI18nMap(array $i18n_map)  | 
                                                        
| 149 | 148 |      { | 
                                                        
| 150 | 149 |          if (empty($i18n_map)) { | 
                                                        
| 151 | - $i18n_map = file_exists($this->domain->pluginPath() . 'translation-map.json')  | 
                                                        |
| 150 | + $i18n_map = file_exists($this->domain->pluginPath().'translation-map.json')  | 
                                                        |
| 152 | 151 | ? json_decode(  | 
                                                        
| 153 | - file_get_contents($this->domain->pluginPath() . 'translation-map.json'),  | 
                                                        |
| 152 | + file_get_contents($this->domain->pluginPath().'translation-map.json'),  | 
                                                        |
| 154 | 153 | true  | 
                                                        
| 155 | 154 | )  | 
                                                        
| 156 | 155 | : array();  | 
                                                        
@@ -228,7 +227,7 @@ discard block  | 
                                                    ||
| 228 | 227 | ),  | 
                                                        
| 229 | 228 | );  | 
                                                        
| 230 | 229 | |
| 231 | -        if (! empty($translations->headers['Plural-Forms'])) { | 
                                                        |
| 230 | +        if ( ! empty($translations->headers['Plural-Forms'])) { | 
                                                        |
| 232 | 231 | $locale['']['plural_forms'] = $translations->headers['Plural-Forms'];  | 
                                                        
| 233 | 232 | }  | 
                                                        
| 234 | 233 | |
@@ -26,702 +26,702 @@  | 
                                                    ||
| 26 | 26 | class Registry  | 
                                                        
| 27 | 27 |  { | 
                                                        
| 28 | 28 | |
| 29 | - const ASSET_TYPE_CSS = 'css';  | 
                                                        |
| 30 | - const ASSET_TYPE_JS = 'js';  | 
                                                        |
| 31 | - const ASSET_NAMESPACE = 'core';  | 
                                                        |
| 32 | -  | 
                                                        |
| 33 | - /**  | 
                                                        |
| 34 | - * @var EE_Template_Config $template_config  | 
                                                        |
| 35 | - */  | 
                                                        |
| 36 | - protected $template_config;  | 
                                                        |
| 37 | -  | 
                                                        |
| 38 | - /**  | 
                                                        |
| 39 | - * @var EE_Currency_Config $currency_config  | 
                                                        |
| 40 | - */  | 
                                                        |
| 41 | - protected $currency_config;  | 
                                                        |
| 42 | -  | 
                                                        |
| 43 | - /**  | 
                                                        |
| 44 | - * This holds the jsdata data object that will be exposed on pages that enqueue the `eejs-core` script.  | 
                                                        |
| 45 | - *  | 
                                                        |
| 46 | - * @var array  | 
                                                        |
| 47 | - */  | 
                                                        |
| 48 | - protected $jsdata = array();  | 
                                                        |
| 49 | -  | 
                                                        |
| 50 | -  | 
                                                        |
| 51 | - /**  | 
                                                        |
| 52 | - * This keeps track of all scripts with registered data. It is used to prevent duplicate data objects setup in the  | 
                                                        |
| 53 | - * page source.  | 
                                                        |
| 54 | - * @var array  | 
                                                        |
| 55 | - */  | 
                                                        |
| 56 | - protected $script_handles_with_data = array();  | 
                                                        |
| 57 | -  | 
                                                        |
| 58 | -  | 
                                                        |
| 59 | - /**  | 
                                                        |
| 60 | - * @var DomainInterface  | 
                                                        |
| 61 | - */  | 
                                                        |
| 62 | - protected $domain;  | 
                                                        |
| 63 | -  | 
                                                        |
| 64 | -  | 
                                                        |
| 65 | - /**  | 
                                                        |
| 66 | - * @var I18nRegistry  | 
                                                        |
| 67 | - */  | 
                                                        |
| 68 | - private $i18n_registry;  | 
                                                        |
| 69 | -  | 
                                                        |
| 70 | -  | 
                                                        |
| 71 | -  | 
                                                        |
| 72 | - /**  | 
                                                        |
| 73 | - * Holds the manifest data obtained from registered manifest files.  | 
                                                        |
| 74 | - * Manifests are maps of asset chunk name to actual built asset file names.  | 
                                                        |
| 75 | - * Shape of this array is:  | 
                                                        |
| 76 | - *  | 
                                                        |
| 77 | - * array(  | 
                                                        |
| 78 | - * 'some_namespace_slug' => array(  | 
                                                        |
| 79 | - * 'some_chunk_name' => array(  | 
                                                        |
| 80 | - * 'js' => 'filename.js'  | 
                                                        |
| 81 | - * 'css' => 'filename.js'  | 
                                                        |
| 82 | - * ),  | 
                                                        |
| 83 | - * 'url_base' => 'https://baseurl.com/to/assets  | 
                                                        |
| 84 | - * )  | 
                                                        |
| 85 | - * )  | 
                                                        |
| 86 | - *  | 
                                                        |
| 87 | - * @var array  | 
                                                        |
| 88 | - */  | 
                                                        |
| 89 | - private $manifest_data = array();  | 
                                                        |
| 90 | -  | 
                                                        |
| 91 | -  | 
                                                        |
| 92 | - /**  | 
                                                        |
| 93 | - * Registry constructor.  | 
                                                        |
| 94 | - * Hooking into WP actions for script registry.  | 
                                                        |
| 95 | - *  | 
                                                        |
| 96 | - * @param EE_Template_Config $template_config  | 
                                                        |
| 97 | - * @param EE_Currency_Config $currency_config  | 
                                                        |
| 98 | - * @param I18nRegistry $i18n_registry  | 
                                                        |
| 99 | - * @param DomainInterface $domain  | 
                                                        |
| 100 | - * @throws InvalidArgumentException  | 
                                                        |
| 101 | - * @throws InvalidFilePathException  | 
                                                        |
| 102 | - */  | 
                                                        |
| 103 | - public function __construct(  | 
                                                        |
| 104 | - EE_Template_Config $template_config,  | 
                                                        |
| 105 | - EE_Currency_Config $currency_config,  | 
                                                        |
| 106 | - I18nRegistry $i18n_registry,  | 
                                                        |
| 107 | - DomainInterface $domain  | 
                                                        |
| 108 | -    ) { | 
                                                        |
| 109 | - $this->template_config = $template_config;  | 
                                                        |
| 110 | - $this->currency_config = $currency_config;  | 
                                                        |
| 111 | - $this->domain = $domain;  | 
                                                        |
| 112 | - $this->i18n_registry = $i18n_registry;  | 
                                                        |
| 113 | - $this->registerManifestFile(  | 
                                                        |
| 114 | - self::ASSET_NAMESPACE,  | 
                                                        |
| 115 | - $this->domain->distributionAssetsUrl(),  | 
                                                        |
| 116 | - $this->domain->distributionAssetsPath() . 'build-manifest.json'  | 
                                                        |
| 117 | - );  | 
                                                        |
| 118 | -        add_action('wp_enqueue_scripts', array($this, 'scripts'), 1); | 
                                                        |
| 119 | -        add_action('admin_enqueue_scripts', array($this, 'scripts'), 1); | 
                                                        |
| 120 | -        add_action('wp_enqueue_scripts', array($this, 'enqueueData'), 2); | 
                                                        |
| 121 | -        add_action('admin_enqueue_scripts', array($this, 'enqueueData'), 2); | 
                                                        |
| 122 | -        add_action('wp_print_footer_scripts', array($this, 'enqueueData'), 1); | 
                                                        |
| 123 | -        add_action('admin_print_footer_scripts', array($this, 'enqueueData'), 1); | 
                                                        |
| 124 | - }  | 
                                                        |
| 125 | -  | 
                                                        |
| 126 | -  | 
                                                        |
| 127 | - /**  | 
                                                        |
| 128 | - * For classes that have Registry as a dependency, this provides a handy way to register script handles for i18n  | 
                                                        |
| 129 | - * translation handling.  | 
                                                        |
| 130 | - *  | 
                                                        |
| 131 | - * @return I18nRegistry  | 
                                                        |
| 132 | - */  | 
                                                        |
| 133 | - public function getI18nRegistry()  | 
                                                        |
| 134 | -    { | 
                                                        |
| 135 | - return $this->i18n_registry;  | 
                                                        |
| 136 | - }  | 
                                                        |
| 137 | -  | 
                                                        |
| 138 | - /**  | 
                                                        |
| 139 | - * Callback for the WP script actions.  | 
                                                        |
| 140 | - * Used to register globally accessible core scripts.  | 
                                                        |
| 141 | - * Also used to add the eejs.data object to the source for any js having eejs-core as a dependency.  | 
                                                        |
| 142 | - *  | 
                                                        |
| 143 | - */  | 
                                                        |
| 144 | - public function scripts()  | 
                                                        |
| 145 | -    { | 
                                                        |
| 146 | - global $wp_version;  | 
                                                        |
| 147 | - wp_register_script(  | 
                                                        |
| 148 | - 'ee-manifest',  | 
                                                        |
| 149 | - $this->getJsUrl(self::ASSET_NAMESPACE, 'manifest'),  | 
                                                        |
| 150 | - array(),  | 
                                                        |
| 151 | - null,  | 
                                                        |
| 152 | - true  | 
                                                        |
| 153 | - );  | 
                                                        |
| 154 | - wp_register_script(  | 
                                                        |
| 155 | - 'eejs-core',  | 
                                                        |
| 156 | - $this->getJsUrl(self::ASSET_NAMESPACE, 'eejs'),  | 
                                                        |
| 157 | -            array('ee-manifest'), | 
                                                        |
| 158 | - null,  | 
                                                        |
| 159 | - true  | 
                                                        |
| 160 | - );  | 
                                                        |
| 161 | - wp_register_script(  | 
                                                        |
| 162 | - 'ee-vendor-react',  | 
                                                        |
| 163 | - $this->getJsUrl(self::ASSET_NAMESPACE, 'reactVendor'),  | 
                                                        |
| 164 | -            array('eejs-core'), | 
                                                        |
| 165 | - null,  | 
                                                        |
| 166 | - true  | 
                                                        |
| 167 | - );  | 
                                                        |
| 168 | - //only run this if WordPress 4.4.0 > is in use.  | 
                                                        |
| 169 | -        if (version_compare($wp_version, '4.4.0', '>')) { | 
                                                        |
| 170 | - //js.api  | 
                                                        |
| 171 | - wp_register_script(  | 
                                                        |
| 172 | - 'eejs-api',  | 
                                                        |
| 173 | - EE_LIBRARIES_URL . 'rest_api/assets/js/eejs-api.min.js',  | 
                                                        |
| 174 | -                array('underscore', 'eejs-core'), | 
                                                        |
| 175 | - EVENT_ESPRESSO_VERSION,  | 
                                                        |
| 176 | - true  | 
                                                        |
| 177 | - );  | 
                                                        |
| 178 | -            $this->jsdata['eejs_api_nonce'] = wp_create_nonce('wp_rest'); | 
                                                        |
| 179 | -            $this->jsdata['paths'] = array('rest_route' => rest_url('ee/v4.8.36/')); | 
                                                        |
| 180 | - }  | 
                                                        |
| 181 | -        if (! is_admin()) { | 
                                                        |
| 182 | - $this->loadCoreCss();  | 
                                                        |
| 183 | - }  | 
                                                        |
| 184 | -        $this->registerTranslationsForHandles(array('eejs-core')); | 
                                                        |
| 185 | - $this->loadCoreJs();  | 
                                                        |
| 186 | - $this->loadJqueryValidate();  | 
                                                        |
| 187 | - $this->loadAccountingJs();  | 
                                                        |
| 188 | - $this->loadQtipJs();  | 
                                                        |
| 189 | - $this->registerAdminAssets();  | 
                                                        |
| 190 | - }  | 
                                                        |
| 191 | -  | 
                                                        |
| 192 | -  | 
                                                        |
| 193 | -  | 
                                                        |
| 194 | - /**  | 
                                                        |
| 195 | - * Call back for the script print in frontend and backend.  | 
                                                        |
| 196 | - * Used to call wp_localize_scripts so that data can be added throughout the runtime until this later hook point.  | 
                                                        |
| 197 | - *  | 
                                                        |
| 198 | - * @since 4.9.31.rc.015  | 
                                                        |
| 199 | - */  | 
                                                        |
| 200 | - public function enqueueData()  | 
                                                        |
| 201 | -    { | 
                                                        |
| 202 | - $this->removeAlreadyRegisteredDataForScriptHandles();  | 
                                                        |
| 203 | - wp_add_inline_script(  | 
                                                        |
| 204 | - 'eejs-core',  | 
                                                        |
| 205 | -            'var eejsdata=' . wp_json_encode(array('data' => $this->jsdata)), | 
                                                        |
| 206 | - 'before'  | 
                                                        |
| 207 | - );  | 
                                                        |
| 208 | -        wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); | 
                                                        |
| 209 | - $this->localizeAccountingJs();  | 
                                                        |
| 210 | -        $this->addRegisteredScriptHandlesWithData('eejs-core'); | 
                                                        |
| 211 | -        $this->addRegisteredScriptHandlesWithData('espresso_core'); | 
                                                        |
| 212 | - }  | 
                                                        |
| 213 | -  | 
                                                        |
| 214 | -  | 
                                                        |
| 215 | -  | 
                                                        |
| 216 | - /**  | 
                                                        |
| 217 | - * Used to add data to eejs.data object.  | 
                                                        |
| 218 | - * Note: Overriding existing data is not allowed.  | 
                                                        |
| 219 | - * Data will be accessible as a javascript object when you list `eejs-core` as a dependency for your javascript.  | 
                                                        |
| 220 | - * If the data you add is something like this:  | 
                                                        |
| 221 | - * $this->addData( 'my_plugin_data', array( 'foo' => 'gar' ) );  | 
                                                        |
| 222 | - * It will be exposed in the page source as:  | 
                                                        |
| 223 | - * eejs.data.my_plugin_data.foo == gar  | 
                                                        |
| 224 | - *  | 
                                                        |
| 225 | - * @param string $key Key used to access your data  | 
                                                        |
| 226 | - * @param string|array $value Value to attach to key  | 
                                                        |
| 227 | - * @throws InvalidArgumentException  | 
                                                        |
| 228 | - */  | 
                                                        |
| 229 | - public function addData($key, $value)  | 
                                                        |
| 230 | -    { | 
                                                        |
| 231 | -        if ($this->verifyDataNotExisting($key)) { | 
                                                        |
| 232 | - $this->jsdata[$key] = $value;  | 
                                                        |
| 233 | - }  | 
                                                        |
| 234 | - }  | 
                                                        |
| 235 | -  | 
                                                        |
| 236 | -  | 
                                                        |
| 237 | -  | 
                                                        |
| 238 | - /**  | 
                                                        |
| 239 | - * Similar to addData except this allows for users to push values to an existing key where the values on key are  | 
                                                        |
| 240 | - * elements in an array.  | 
                                                        |
| 241 | - * When you use this method, the value you include will be appended to the end of an array on $key.  | 
                                                        |
| 242 | - * So if the $key was 'test' and you added a value of 'my_data' then it would be represented in the javascript  | 
                                                        |
| 243 | - * object like this, eejs.data.test = [ my_data,  | 
                                                        |
| 244 | - * ]  | 
                                                        |
| 245 | - * If there has already been a scalar value attached to the data object given key, then  | 
                                                        |
| 246 | - * this will throw an exception.  | 
                                                        |
| 247 | - *  | 
                                                        |
| 248 | - * @param string $key Key to attach data to.  | 
                                                        |
| 249 | - * @param string|array $value Value being registered.  | 
                                                        |
| 250 | - * @throws InvalidArgumentException  | 
                                                        |
| 251 | - */  | 
                                                        |
| 252 | - public function pushData($key, $value)  | 
                                                        |
| 253 | -    { | 
                                                        |
| 254 | - if (isset($this->jsdata[$key])  | 
                                                        |
| 255 | - && ! is_array($this->jsdata[$key])  | 
                                                        |
| 256 | -        ) { | 
                                                        |
| 257 | - throw new invalidArgumentException(  | 
                                                        |
| 258 | - sprintf(  | 
                                                        |
| 259 | - __(  | 
                                                        |
| 260 | - 'The value for %1$s is already set and it is not an array. The %2$s method can only be used to  | 
                                                        |
| 29 | + const ASSET_TYPE_CSS = 'css';  | 
                                                        |
| 30 | + const ASSET_TYPE_JS = 'js';  | 
                                                        |
| 31 | + const ASSET_NAMESPACE = 'core';  | 
                                                        |
| 32 | +  | 
                                                        |
| 33 | + /**  | 
                                                        |
| 34 | + * @var EE_Template_Config $template_config  | 
                                                        |
| 35 | + */  | 
                                                        |
| 36 | + protected $template_config;  | 
                                                        |
| 37 | +  | 
                                                        |
| 38 | + /**  | 
                                                        |
| 39 | + * @var EE_Currency_Config $currency_config  | 
                                                        |
| 40 | + */  | 
                                                        |
| 41 | + protected $currency_config;  | 
                                                        |
| 42 | +  | 
                                                        |
| 43 | + /**  | 
                                                        |
| 44 | + * This holds the jsdata data object that will be exposed on pages that enqueue the `eejs-core` script.  | 
                                                        |
| 45 | + *  | 
                                                        |
| 46 | + * @var array  | 
                                                        |
| 47 | + */  | 
                                                        |
| 48 | + protected $jsdata = array();  | 
                                                        |
| 49 | +  | 
                                                        |
| 50 | +  | 
                                                        |
| 51 | + /**  | 
                                                        |
| 52 | + * This keeps track of all scripts with registered data. It is used to prevent duplicate data objects setup in the  | 
                                                        |
| 53 | + * page source.  | 
                                                        |
| 54 | + * @var array  | 
                                                        |
| 55 | + */  | 
                                                        |
| 56 | + protected $script_handles_with_data = array();  | 
                                                        |
| 57 | +  | 
                                                        |
| 58 | +  | 
                                                        |
| 59 | + /**  | 
                                                        |
| 60 | + * @var DomainInterface  | 
                                                        |
| 61 | + */  | 
                                                        |
| 62 | + protected $domain;  | 
                                                        |
| 63 | +  | 
                                                        |
| 64 | +  | 
                                                        |
| 65 | + /**  | 
                                                        |
| 66 | + * @var I18nRegistry  | 
                                                        |
| 67 | + */  | 
                                                        |
| 68 | + private $i18n_registry;  | 
                                                        |
| 69 | +  | 
                                                        |
| 70 | +  | 
                                                        |
| 71 | +  | 
                                                        |
| 72 | + /**  | 
                                                        |
| 73 | + * Holds the manifest data obtained from registered manifest files.  | 
                                                        |
| 74 | + * Manifests are maps of asset chunk name to actual built asset file names.  | 
                                                        |
| 75 | + * Shape of this array is:  | 
                                                        |
| 76 | + *  | 
                                                        |
| 77 | + * array(  | 
                                                        |
| 78 | + * 'some_namespace_slug' => array(  | 
                                                        |
| 79 | + * 'some_chunk_name' => array(  | 
                                                        |
| 80 | + * 'js' => 'filename.js'  | 
                                                        |
| 81 | + * 'css' => 'filename.js'  | 
                                                        |
| 82 | + * ),  | 
                                                        |
| 83 | + * 'url_base' => 'https://baseurl.com/to/assets  | 
                                                        |
| 84 | + * )  | 
                                                        |
| 85 | + * )  | 
                                                        |
| 86 | + *  | 
                                                        |
| 87 | + * @var array  | 
                                                        |
| 88 | + */  | 
                                                        |
| 89 | + private $manifest_data = array();  | 
                                                        |
| 90 | +  | 
                                                        |
| 91 | +  | 
                                                        |
| 92 | + /**  | 
                                                        |
| 93 | + * Registry constructor.  | 
                                                        |
| 94 | + * Hooking into WP actions for script registry.  | 
                                                        |
| 95 | + *  | 
                                                        |
| 96 | + * @param EE_Template_Config $template_config  | 
                                                        |
| 97 | + * @param EE_Currency_Config $currency_config  | 
                                                        |
| 98 | + * @param I18nRegistry $i18n_registry  | 
                                                        |
| 99 | + * @param DomainInterface $domain  | 
                                                        |
| 100 | + * @throws InvalidArgumentException  | 
                                                        |
| 101 | + * @throws InvalidFilePathException  | 
                                                        |
| 102 | + */  | 
                                                        |
| 103 | + public function __construct(  | 
                                                        |
| 104 | + EE_Template_Config $template_config,  | 
                                                        |
| 105 | + EE_Currency_Config $currency_config,  | 
                                                        |
| 106 | + I18nRegistry $i18n_registry,  | 
                                                        |
| 107 | + DomainInterface $domain  | 
                                                        |
| 108 | +	) { | 
                                                        |
| 109 | + $this->template_config = $template_config;  | 
                                                        |
| 110 | + $this->currency_config = $currency_config;  | 
                                                        |
| 111 | + $this->domain = $domain;  | 
                                                        |
| 112 | + $this->i18n_registry = $i18n_registry;  | 
                                                        |
| 113 | + $this->registerManifestFile(  | 
                                                        |
| 114 | + self::ASSET_NAMESPACE,  | 
                                                        |
| 115 | + $this->domain->distributionAssetsUrl(),  | 
                                                        |
| 116 | + $this->domain->distributionAssetsPath() . 'build-manifest.json'  | 
                                                        |
| 117 | + );  | 
                                                        |
| 118 | +		add_action('wp_enqueue_scripts', array($this, 'scripts'), 1); | 
                                                        |
| 119 | +		add_action('admin_enqueue_scripts', array($this, 'scripts'), 1); | 
                                                        |
| 120 | +		add_action('wp_enqueue_scripts', array($this, 'enqueueData'), 2); | 
                                                        |
| 121 | +		add_action('admin_enqueue_scripts', array($this, 'enqueueData'), 2); | 
                                                        |
| 122 | +		add_action('wp_print_footer_scripts', array($this, 'enqueueData'), 1); | 
                                                        |
| 123 | +		add_action('admin_print_footer_scripts', array($this, 'enqueueData'), 1); | 
                                                        |
| 124 | + }  | 
                                                        |
| 125 | +  | 
                                                        |
| 126 | +  | 
                                                        |
| 127 | + /**  | 
                                                        |
| 128 | + * For classes that have Registry as a dependency, this provides a handy way to register script handles for i18n  | 
                                                        |
| 129 | + * translation handling.  | 
                                                        |
| 130 | + *  | 
                                                        |
| 131 | + * @return I18nRegistry  | 
                                                        |
| 132 | + */  | 
                                                        |
| 133 | + public function getI18nRegistry()  | 
                                                        |
| 134 | +	{ | 
                                                        |
| 135 | + return $this->i18n_registry;  | 
                                                        |
| 136 | + }  | 
                                                        |
| 137 | +  | 
                                                        |
| 138 | + /**  | 
                                                        |
| 139 | + * Callback for the WP script actions.  | 
                                                        |
| 140 | + * Used to register globally accessible core scripts.  | 
                                                        |
| 141 | + * Also used to add the eejs.data object to the source for any js having eejs-core as a dependency.  | 
                                                        |
| 142 | + *  | 
                                                        |
| 143 | + */  | 
                                                        |
| 144 | + public function scripts()  | 
                                                        |
| 145 | +	{ | 
                                                        |
| 146 | + global $wp_version;  | 
                                                        |
| 147 | + wp_register_script(  | 
                                                        |
| 148 | + 'ee-manifest',  | 
                                                        |
| 149 | + $this->getJsUrl(self::ASSET_NAMESPACE, 'manifest'),  | 
                                                        |
| 150 | + array(),  | 
                                                        |
| 151 | + null,  | 
                                                        |
| 152 | + true  | 
                                                        |
| 153 | + );  | 
                                                        |
| 154 | + wp_register_script(  | 
                                                        |
| 155 | + 'eejs-core',  | 
                                                        |
| 156 | + $this->getJsUrl(self::ASSET_NAMESPACE, 'eejs'),  | 
                                                        |
| 157 | +			array('ee-manifest'), | 
                                                        |
| 158 | + null,  | 
                                                        |
| 159 | + true  | 
                                                        |
| 160 | + );  | 
                                                        |
| 161 | + wp_register_script(  | 
                                                        |
| 162 | + 'ee-vendor-react',  | 
                                                        |
| 163 | + $this->getJsUrl(self::ASSET_NAMESPACE, 'reactVendor'),  | 
                                                        |
| 164 | +			array('eejs-core'), | 
                                                        |
| 165 | + null,  | 
                                                        |
| 166 | + true  | 
                                                        |
| 167 | + );  | 
                                                        |
| 168 | + //only run this if WordPress 4.4.0 > is in use.  | 
                                                        |
| 169 | +		if (version_compare($wp_version, '4.4.0', '>')) { | 
                                                        |
| 170 | + //js.api  | 
                                                        |
| 171 | + wp_register_script(  | 
                                                        |
| 172 | + 'eejs-api',  | 
                                                        |
| 173 | + EE_LIBRARIES_URL . 'rest_api/assets/js/eejs-api.min.js',  | 
                                                        |
| 174 | +				array('underscore', 'eejs-core'), | 
                                                        |
| 175 | + EVENT_ESPRESSO_VERSION,  | 
                                                        |
| 176 | + true  | 
                                                        |
| 177 | + );  | 
                                                        |
| 178 | +			$this->jsdata['eejs_api_nonce'] = wp_create_nonce('wp_rest'); | 
                                                        |
| 179 | +			$this->jsdata['paths'] = array('rest_route' => rest_url('ee/v4.8.36/')); | 
                                                        |
| 180 | + }  | 
                                                        |
| 181 | +		if (! is_admin()) { | 
                                                        |
| 182 | + $this->loadCoreCss();  | 
                                                        |
| 183 | + }  | 
                                                        |
| 184 | +		$this->registerTranslationsForHandles(array('eejs-core')); | 
                                                        |
| 185 | + $this->loadCoreJs();  | 
                                                        |
| 186 | + $this->loadJqueryValidate();  | 
                                                        |
| 187 | + $this->loadAccountingJs();  | 
                                                        |
| 188 | + $this->loadQtipJs();  | 
                                                        |
| 189 | + $this->registerAdminAssets();  | 
                                                        |
| 190 | + }  | 
                                                        |
| 191 | +  | 
                                                        |
| 192 | +  | 
                                                        |
| 193 | +  | 
                                                        |
| 194 | + /**  | 
                                                        |
| 195 | + * Call back for the script print in frontend and backend.  | 
                                                        |
| 196 | + * Used to call wp_localize_scripts so that data can be added throughout the runtime until this later hook point.  | 
                                                        |
| 197 | + *  | 
                                                        |
| 198 | + * @since 4.9.31.rc.015  | 
                                                        |
| 199 | + */  | 
                                                        |
| 200 | + public function enqueueData()  | 
                                                        |
| 201 | +	{ | 
                                                        |
| 202 | + $this->removeAlreadyRegisteredDataForScriptHandles();  | 
                                                        |
| 203 | + wp_add_inline_script(  | 
                                                        |
| 204 | + 'eejs-core',  | 
                                                        |
| 205 | +			'var eejsdata=' . wp_json_encode(array('data' => $this->jsdata)), | 
                                                        |
| 206 | + 'before'  | 
                                                        |
| 207 | + );  | 
                                                        |
| 208 | +		wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); | 
                                                        |
| 209 | + $this->localizeAccountingJs();  | 
                                                        |
| 210 | +		$this->addRegisteredScriptHandlesWithData('eejs-core'); | 
                                                        |
| 211 | +		$this->addRegisteredScriptHandlesWithData('espresso_core'); | 
                                                        |
| 212 | + }  | 
                                                        |
| 213 | +  | 
                                                        |
| 214 | +  | 
                                                        |
| 215 | +  | 
                                                        |
| 216 | + /**  | 
                                                        |
| 217 | + * Used to add data to eejs.data object.  | 
                                                        |
| 218 | + * Note: Overriding existing data is not allowed.  | 
                                                        |
| 219 | + * Data will be accessible as a javascript object when you list `eejs-core` as a dependency for your javascript.  | 
                                                        |
| 220 | + * If the data you add is something like this:  | 
                                                        |
| 221 | + * $this->addData( 'my_plugin_data', array( 'foo' => 'gar' ) );  | 
                                                        |
| 222 | + * It will be exposed in the page source as:  | 
                                                        |
| 223 | + * eejs.data.my_plugin_data.foo == gar  | 
                                                        |
| 224 | + *  | 
                                                        |
| 225 | + * @param string $key Key used to access your data  | 
                                                        |
| 226 | + * @param string|array $value Value to attach to key  | 
                                                        |
| 227 | + * @throws InvalidArgumentException  | 
                                                        |
| 228 | + */  | 
                                                        |
| 229 | + public function addData($key, $value)  | 
                                                        |
| 230 | +	{ | 
                                                        |
| 231 | +		if ($this->verifyDataNotExisting($key)) { | 
                                                        |
| 232 | + $this->jsdata[$key] = $value;  | 
                                                        |
| 233 | + }  | 
                                                        |
| 234 | + }  | 
                                                        |
| 235 | +  | 
                                                        |
| 236 | +  | 
                                                        |
| 237 | +  | 
                                                        |
| 238 | + /**  | 
                                                        |
| 239 | + * Similar to addData except this allows for users to push values to an existing key where the values on key are  | 
                                                        |
| 240 | + * elements in an array.  | 
                                                        |
| 241 | + * When you use this method, the value you include will be appended to the end of an array on $key.  | 
                                                        |
| 242 | + * So if the $key was 'test' and you added a value of 'my_data' then it would be represented in the javascript  | 
                                                        |
| 243 | + * object like this, eejs.data.test = [ my_data,  | 
                                                        |
| 244 | + * ]  | 
                                                        |
| 245 | + * If there has already been a scalar value attached to the data object given key, then  | 
                                                        |
| 246 | + * this will throw an exception.  | 
                                                        |
| 247 | + *  | 
                                                        |
| 248 | + * @param string $key Key to attach data to.  | 
                                                        |
| 249 | + * @param string|array $value Value being registered.  | 
                                                        |
| 250 | + * @throws InvalidArgumentException  | 
                                                        |
| 251 | + */  | 
                                                        |
| 252 | + public function pushData($key, $value)  | 
                                                        |
| 253 | +	{ | 
                                                        |
| 254 | + if (isset($this->jsdata[$key])  | 
                                                        |
| 255 | + && ! is_array($this->jsdata[$key])  | 
                                                        |
| 256 | +		) { | 
                                                        |
| 257 | + throw new invalidArgumentException(  | 
                                                        |
| 258 | + sprintf(  | 
                                                        |
| 259 | + __(  | 
                                                        |
| 260 | + 'The value for %1$s is already set and it is not an array. The %2$s method can only be used to  | 
                                                        |
| 261 | 261 | push values to this data element when it is an array.',  | 
                                                        
| 262 | - 'event_espresso'  | 
                                                        |
| 263 | - ),  | 
                                                        |
| 264 | - $key,  | 
                                                        |
| 265 | - __METHOD__  | 
                                                        |
| 266 | - )  | 
                                                        |
| 267 | - );  | 
                                                        |
| 268 | - }  | 
                                                        |
| 269 | - $this->jsdata[$key][] = $value;  | 
                                                        |
| 270 | - }  | 
                                                        |
| 271 | -  | 
                                                        |
| 272 | -  | 
                                                        |
| 273 | -  | 
                                                        |
| 274 | - /**  | 
                                                        |
| 275 | - * Used to set content used by javascript for a template.  | 
                                                        |
| 276 | - * Note: Overrides of existing registered templates are not allowed.  | 
                                                        |
| 277 | - *  | 
                                                        |
| 278 | - * @param string $template_reference  | 
                                                        |
| 279 | - * @param string $template_content  | 
                                                        |
| 280 | - * @throws InvalidArgumentException  | 
                                                        |
| 281 | - */  | 
                                                        |
| 282 | - public function addTemplate($template_reference, $template_content)  | 
                                                        |
| 283 | -    { | 
                                                        |
| 284 | -        if (! isset($this->jsdata['templates'])) { | 
                                                        |
| 285 | - $this->jsdata['templates'] = array();  | 
                                                        |
| 286 | - }  | 
                                                        |
| 287 | - //no overrides allowed.  | 
                                                        |
| 288 | -        if (isset($this->jsdata['templates'][$template_reference])) { | 
                                                        |
| 289 | - throw new invalidArgumentException(  | 
                                                        |
| 290 | - sprintf(  | 
                                                        |
| 291 | - __(  | 
                                                        |
| 292 | - 'The %1$s key already exists for the templates array in the js data array. No overrides are allowed.',  | 
                                                        |
| 293 | - 'event_espresso'  | 
                                                        |
| 294 | - ),  | 
                                                        |
| 295 | - $template_reference  | 
                                                        |
| 296 | - )  | 
                                                        |
| 297 | - );  | 
                                                        |
| 298 | - }  | 
                                                        |
| 299 | - $this->jsdata['templates'][$template_reference] = $template_content;  | 
                                                        |
| 300 | - }  | 
                                                        |
| 301 | -  | 
                                                        |
| 302 | -  | 
                                                        |
| 303 | -  | 
                                                        |
| 304 | - /**  | 
                                                        |
| 305 | - * Retrieve the template content already registered for the given reference.  | 
                                                        |
| 306 | - *  | 
                                                        |
| 307 | - * @param string $template_reference  | 
                                                        |
| 308 | - * @return string  | 
                                                        |
| 309 | - */  | 
                                                        |
| 310 | - public function getTemplate($template_reference)  | 
                                                        |
| 311 | -    { | 
                                                        |
| 312 | - return isset($this->jsdata['templates'], $this->jsdata['templates'][$template_reference])  | 
                                                        |
| 313 | - ? $this->jsdata['templates'][$template_reference]  | 
                                                        |
| 314 | - : '';  | 
                                                        |
| 315 | - }  | 
                                                        |
| 316 | -  | 
                                                        |
| 317 | -  | 
                                                        |
| 318 | -  | 
                                                        |
| 319 | - /**  | 
                                                        |
| 320 | - * Retrieve registered data.  | 
                                                        |
| 321 | - *  | 
                                                        |
| 322 | - * @param string $key Name of key to attach data to.  | 
                                                        |
| 323 | - * @return mixed If there is no for the given key, then false is returned.  | 
                                                        |
| 324 | - */  | 
                                                        |
| 325 | - public function getData($key)  | 
                                                        |
| 326 | -    { | 
                                                        |
| 327 | - return isset($this->jsdata[$key])  | 
                                                        |
| 328 | - ? $this->jsdata[$key]  | 
                                                        |
| 329 | - : false;  | 
                                                        |
| 330 | - }  | 
                                                        |
| 331 | -  | 
                                                        |
| 332 | -  | 
                                                        |
| 333 | - /**  | 
                                                        |
| 334 | - * Get the actual asset path for asset manifests.  | 
                                                        |
| 335 | - * If there is no asset path found for the given $chunk_name, then the $chunk_name is returned.  | 
                                                        |
| 336 | - * @param string $namespace The namespace associated with the manifest file hosting the map of chunk_name to actual  | 
                                                        |
| 337 | - * asset file location.  | 
                                                        |
| 338 | - * @param string $chunk_name  | 
                                                        |
| 339 | - * @param string $asset_type  | 
                                                        |
| 340 | - * @return string  | 
                                                        |
| 341 | - * @since 4.9.59.p  | 
                                                        |
| 342 | - */  | 
                                                        |
| 343 | - public function getAssetUrl($namespace, $chunk_name, $asset_type)  | 
                                                        |
| 344 | -    { | 
                                                        |
| 345 | - $url = isset(  | 
                                                        |
| 346 | - $this->manifest_data[$namespace][$chunk_name][$asset_type],  | 
                                                        |
| 347 | - $this->manifest_data[$namespace]['url_base']  | 
                                                        |
| 348 | - )  | 
                                                        |
| 349 | - ? $this->manifest_data[$namespace]['url_base']  | 
                                                        |
| 350 | - . $this->manifest_data[$namespace][$chunk_name][$asset_type]  | 
                                                        |
| 351 | - : $chunk_name;  | 
                                                        |
| 352 | - return apply_filters(  | 
                                                        |
| 353 | - 'FHEE__EventEspresso_core_services_assets_Registry__getAssetUrl',  | 
                                                        |
| 354 | - $url,  | 
                                                        |
| 355 | - $namespace,  | 
                                                        |
| 356 | - $chunk_name,  | 
                                                        |
| 357 | - $asset_type  | 
                                                        |
| 358 | - );  | 
                                                        |
| 359 | - }  | 
                                                        |
| 360 | -  | 
                                                        |
| 361 | -  | 
                                                        |
| 362 | - /**  | 
                                                        |
| 363 | - * Return the url to a js file for the given namespace and chunk name.  | 
                                                        |
| 364 | - *  | 
                                                        |
| 365 | - * @param string $namespace  | 
                                                        |
| 366 | - * @param string $chunk_name  | 
                                                        |
| 367 | - * @return string  | 
                                                        |
| 368 | - */  | 
                                                        |
| 369 | - public function getJsUrl($namespace, $chunk_name)  | 
                                                        |
| 370 | -    { | 
                                                        |
| 371 | - return $this->getAssetUrl($namespace, $chunk_name, self::ASSET_TYPE_JS);  | 
                                                        |
| 372 | - }  | 
                                                        |
| 373 | -  | 
                                                        |
| 374 | -  | 
                                                        |
| 375 | - /**  | 
                                                        |
| 376 | - * Return the url to a css file for the given namespace and chunk name.  | 
                                                        |
| 377 | - *  | 
                                                        |
| 378 | - * @param string $namespace  | 
                                                        |
| 379 | - * @param string $chunk_name  | 
                                                        |
| 380 | - * @return string  | 
                                                        |
| 381 | - */  | 
                                                        |
| 382 | - public function getCssUrl($namespace, $chunk_name)  | 
                                                        |
| 383 | -    { | 
                                                        |
| 384 | - return $this->getAssetUrl($namespace, $chunk_name, self::ASSET_TYPE_CSS);  | 
                                                        |
| 385 | - }  | 
                                                        |
| 386 | -  | 
                                                        |
| 387 | -  | 
                                                        |
| 388 | - /**  | 
                                                        |
| 389 | - * Used to register a js/css manifest file with the registered_manifest_files property.  | 
                                                        |
| 390 | - *  | 
                                                        |
| 391 | - * @param string $namespace Provided to associate the manifest file with a specific namespace.  | 
                                                        |
| 392 | - * @param string $url_base The url base for the manifest file location.  | 
                                                        |
| 393 | - * @param string $manifest_file The absolute path to the manifest file.  | 
                                                        |
| 394 | - * @throws InvalidArgumentException  | 
                                                        |
| 395 | - * @throws InvalidFilePathException  | 
                                                        |
| 396 | - * @since 4.9.59.p  | 
                                                        |
| 397 | - */  | 
                                                        |
| 398 | - public function registerManifestFile($namespace, $url_base, $manifest_file)  | 
                                                        |
| 399 | -    { | 
                                                        |
| 400 | -        if (isset($this->manifest_data[$namespace])) { | 
                                                        |
| 401 | - throw new InvalidArgumentException(  | 
                                                        |
| 402 | - sprintf(  | 
                                                        |
| 403 | - esc_html__(  | 
                                                        |
| 404 | - 'The namespace for this manifest file has already been registered, choose a namespace other than %s',  | 
                                                        |
| 405 | - 'event_espresso'  | 
                                                        |
| 406 | - ),  | 
                                                        |
| 407 | - $namespace  | 
                                                        |
| 408 | - )  | 
                                                        |
| 409 | - );  | 
                                                        |
| 410 | - }  | 
                                                        |
| 411 | -        if (filter_var($url_base, FILTER_VALIDATE_URL) === false) { | 
                                                        |
| 412 | -            if (is_admin()) { | 
                                                        |
| 413 | - EE_Error::add_error(  | 
                                                        |
| 414 | - sprintf(  | 
                                                        |
| 415 | - esc_html__(  | 
                                                        |
| 416 | - 'The url given for %1$s assets is invalid. The url provided was: "%2$s". This usually happens when another plugin or theme on a site is using the "%3$s" filter or has an invalid url set for the "%4$s" constant',  | 
                                                        |
| 417 | - 'event_espresso'  | 
                                                        |
| 418 | - ),  | 
                                                        |
| 419 | - 'Event Espresso',  | 
                                                        |
| 420 | - $url_base,  | 
                                                        |
| 421 | - 'plugins_url',  | 
                                                        |
| 422 | - 'WP_PLUGIN_URL'  | 
                                                        |
| 423 | - ),  | 
                                                        |
| 424 | - __FILE__,  | 
                                                        |
| 425 | - __FUNCTION__,  | 
                                                        |
| 426 | - __LINE__  | 
                                                        |
| 427 | - );  | 
                                                        |
| 428 | - }  | 
                                                        |
| 429 | - return;  | 
                                                        |
| 430 | - }  | 
                                                        |
| 431 | - $this->manifest_data[$namespace] = $this->decodeManifestFile($manifest_file);  | 
                                                        |
| 432 | -        if (! isset($this->manifest_data[$namespace]['url_base'])) { | 
                                                        |
| 433 | - $this->manifest_data[$namespace]['url_base'] = trailingslashit($url_base);  | 
                                                        |
| 434 | - }  | 
                                                        |
| 435 | - }  | 
                                                        |
| 436 | -  | 
                                                        |
| 437 | -  | 
                                                        |
| 438 | -  | 
                                                        |
| 439 | - /**  | 
                                                        |
| 440 | - * Decodes json from the provided manifest file.  | 
                                                        |
| 441 | - *  | 
                                                        |
| 442 | - * @since 4.9.59.p  | 
                                                        |
| 443 | - * @param string $manifest_file Path to manifest file.  | 
                                                        |
| 444 | - * @return array  | 
                                                        |
| 445 | - * @throws InvalidFilePathException  | 
                                                        |
| 446 | - */  | 
                                                        |
| 447 | - private function decodeManifestFile($manifest_file)  | 
                                                        |
| 448 | -    { | 
                                                        |
| 449 | -        if (! file_exists($manifest_file)) { | 
                                                        |
| 450 | - throw new InvalidFilePathException($manifest_file);  | 
                                                        |
| 451 | - }  | 
                                                        |
| 452 | - return json_decode(file_get_contents($manifest_file), true);  | 
                                                        |
| 453 | - }  | 
                                                        |
| 454 | -  | 
                                                        |
| 455 | -  | 
                                                        |
| 456 | -  | 
                                                        |
| 457 | - /**  | 
                                                        |
| 458 | - * Verifies whether the given data exists already on the jsdata array.  | 
                                                        |
| 459 | - * Overriding data is not allowed.  | 
                                                        |
| 460 | - *  | 
                                                        |
| 461 | - * @param string $key Index for data.  | 
                                                        |
| 462 | - * @return bool If valid then return true.  | 
                                                        |
| 463 | - * @throws InvalidArgumentException if data already exists.  | 
                                                        |
| 464 | - */  | 
                                                        |
| 465 | - protected function verifyDataNotExisting($key)  | 
                                                        |
| 466 | -    { | 
                                                        |
| 467 | -        if (isset($this->jsdata[$key])) { | 
                                                        |
| 468 | -            if (is_array($this->jsdata[$key])) { | 
                                                        |
| 469 | - throw new InvalidArgumentException(  | 
                                                        |
| 470 | - sprintf(  | 
                                                        |
| 471 | - __(  | 
                                                        |
| 472 | - 'The value for %1$s already exists in the Registry::eejs object.  | 
                                                        |
| 262 | + 'event_espresso'  | 
                                                        |
| 263 | + ),  | 
                                                        |
| 264 | + $key,  | 
                                                        |
| 265 | + __METHOD__  | 
                                                        |
| 266 | + )  | 
                                                        |
| 267 | + );  | 
                                                        |
| 268 | + }  | 
                                                        |
| 269 | + $this->jsdata[$key][] = $value;  | 
                                                        |
| 270 | + }  | 
                                                        |
| 271 | +  | 
                                                        |
| 272 | +  | 
                                                        |
| 273 | +  | 
                                                        |
| 274 | + /**  | 
                                                        |
| 275 | + * Used to set content used by javascript for a template.  | 
                                                        |
| 276 | + * Note: Overrides of existing registered templates are not allowed.  | 
                                                        |
| 277 | + *  | 
                                                        |
| 278 | + * @param string $template_reference  | 
                                                        |
| 279 | + * @param string $template_content  | 
                                                        |
| 280 | + * @throws InvalidArgumentException  | 
                                                        |
| 281 | + */  | 
                                                        |
| 282 | + public function addTemplate($template_reference, $template_content)  | 
                                                        |
| 283 | +	{ | 
                                                        |
| 284 | +		if (! isset($this->jsdata['templates'])) { | 
                                                        |
| 285 | + $this->jsdata['templates'] = array();  | 
                                                        |
| 286 | + }  | 
                                                        |
| 287 | + //no overrides allowed.  | 
                                                        |
| 288 | +		if (isset($this->jsdata['templates'][$template_reference])) { | 
                                                        |
| 289 | + throw new invalidArgumentException(  | 
                                                        |
| 290 | + sprintf(  | 
                                                        |
| 291 | + __(  | 
                                                        |
| 292 | + 'The %1$s key already exists for the templates array in the js data array. No overrides are allowed.',  | 
                                                        |
| 293 | + 'event_espresso'  | 
                                                        |
| 294 | + ),  | 
                                                        |
| 295 | + $template_reference  | 
                                                        |
| 296 | + )  | 
                                                        |
| 297 | + );  | 
                                                        |
| 298 | + }  | 
                                                        |
| 299 | + $this->jsdata['templates'][$template_reference] = $template_content;  | 
                                                        |
| 300 | + }  | 
                                                        |
| 301 | +  | 
                                                        |
| 302 | +  | 
                                                        |
| 303 | +  | 
                                                        |
| 304 | + /**  | 
                                                        |
| 305 | + * Retrieve the template content already registered for the given reference.  | 
                                                        |
| 306 | + *  | 
                                                        |
| 307 | + * @param string $template_reference  | 
                                                        |
| 308 | + * @return string  | 
                                                        |
| 309 | + */  | 
                                                        |
| 310 | + public function getTemplate($template_reference)  | 
                                                        |
| 311 | +	{ | 
                                                        |
| 312 | + return isset($this->jsdata['templates'], $this->jsdata['templates'][$template_reference])  | 
                                                        |
| 313 | + ? $this->jsdata['templates'][$template_reference]  | 
                                                        |
| 314 | + : '';  | 
                                                        |
| 315 | + }  | 
                                                        |
| 316 | +  | 
                                                        |
| 317 | +  | 
                                                        |
| 318 | +  | 
                                                        |
| 319 | + /**  | 
                                                        |
| 320 | + * Retrieve registered data.  | 
                                                        |
| 321 | + *  | 
                                                        |
| 322 | + * @param string $key Name of key to attach data to.  | 
                                                        |
| 323 | + * @return mixed If there is no for the given key, then false is returned.  | 
                                                        |
| 324 | + */  | 
                                                        |
| 325 | + public function getData($key)  | 
                                                        |
| 326 | +	{ | 
                                                        |
| 327 | + return isset($this->jsdata[$key])  | 
                                                        |
| 328 | + ? $this->jsdata[$key]  | 
                                                        |
| 329 | + : false;  | 
                                                        |
| 330 | + }  | 
                                                        |
| 331 | +  | 
                                                        |
| 332 | +  | 
                                                        |
| 333 | + /**  | 
                                                        |
| 334 | + * Get the actual asset path for asset manifests.  | 
                                                        |
| 335 | + * If there is no asset path found for the given $chunk_name, then the $chunk_name is returned.  | 
                                                        |
| 336 | + * @param string $namespace The namespace associated with the manifest file hosting the map of chunk_name to actual  | 
                                                        |
| 337 | + * asset file location.  | 
                                                        |
| 338 | + * @param string $chunk_name  | 
                                                        |
| 339 | + * @param string $asset_type  | 
                                                        |
| 340 | + * @return string  | 
                                                        |
| 341 | + * @since 4.9.59.p  | 
                                                        |
| 342 | + */  | 
                                                        |
| 343 | + public function getAssetUrl($namespace, $chunk_name, $asset_type)  | 
                                                        |
| 344 | +	{ | 
                                                        |
| 345 | + $url = isset(  | 
                                                        |
| 346 | + $this->manifest_data[$namespace][$chunk_name][$asset_type],  | 
                                                        |
| 347 | + $this->manifest_data[$namespace]['url_base']  | 
                                                        |
| 348 | + )  | 
                                                        |
| 349 | + ? $this->manifest_data[$namespace]['url_base']  | 
                                                        |
| 350 | + . $this->manifest_data[$namespace][$chunk_name][$asset_type]  | 
                                                        |
| 351 | + : $chunk_name;  | 
                                                        |
| 352 | + return apply_filters(  | 
                                                        |
| 353 | + 'FHEE__EventEspresso_core_services_assets_Registry__getAssetUrl',  | 
                                                        |
| 354 | + $url,  | 
                                                        |
| 355 | + $namespace,  | 
                                                        |
| 356 | + $chunk_name,  | 
                                                        |
| 357 | + $asset_type  | 
                                                        |
| 358 | + );  | 
                                                        |
| 359 | + }  | 
                                                        |
| 360 | +  | 
                                                        |
| 361 | +  | 
                                                        |
| 362 | + /**  | 
                                                        |
| 363 | + * Return the url to a js file for the given namespace and chunk name.  | 
                                                        |
| 364 | + *  | 
                                                        |
| 365 | + * @param string $namespace  | 
                                                        |
| 366 | + * @param string $chunk_name  | 
                                                        |
| 367 | + * @return string  | 
                                                        |
| 368 | + */  | 
                                                        |
| 369 | + public function getJsUrl($namespace, $chunk_name)  | 
                                                        |
| 370 | +	{ | 
                                                        |
| 371 | + return $this->getAssetUrl($namespace, $chunk_name, self::ASSET_TYPE_JS);  | 
                                                        |
| 372 | + }  | 
                                                        |
| 373 | +  | 
                                                        |
| 374 | +  | 
                                                        |
| 375 | + /**  | 
                                                        |
| 376 | + * Return the url to a css file for the given namespace and chunk name.  | 
                                                        |
| 377 | + *  | 
                                                        |
| 378 | + * @param string $namespace  | 
                                                        |
| 379 | + * @param string $chunk_name  | 
                                                        |
| 380 | + * @return string  | 
                                                        |
| 381 | + */  | 
                                                        |
| 382 | + public function getCssUrl($namespace, $chunk_name)  | 
                                                        |
| 383 | +	{ | 
                                                        |
| 384 | + return $this->getAssetUrl($namespace, $chunk_name, self::ASSET_TYPE_CSS);  | 
                                                        |
| 385 | + }  | 
                                                        |
| 386 | +  | 
                                                        |
| 387 | +  | 
                                                        |
| 388 | + /**  | 
                                                        |
| 389 | + * Used to register a js/css manifest file with the registered_manifest_files property.  | 
                                                        |
| 390 | + *  | 
                                                        |
| 391 | + * @param string $namespace Provided to associate the manifest file with a specific namespace.  | 
                                                        |
| 392 | + * @param string $url_base The url base for the manifest file location.  | 
                                                        |
| 393 | + * @param string $manifest_file The absolute path to the manifest file.  | 
                                                        |
| 394 | + * @throws InvalidArgumentException  | 
                                                        |
| 395 | + * @throws InvalidFilePathException  | 
                                                        |
| 396 | + * @since 4.9.59.p  | 
                                                        |
| 397 | + */  | 
                                                        |
| 398 | + public function registerManifestFile($namespace, $url_base, $manifest_file)  | 
                                                        |
| 399 | +	{ | 
                                                        |
| 400 | +		if (isset($this->manifest_data[$namespace])) { | 
                                                        |
| 401 | + throw new InvalidArgumentException(  | 
                                                        |
| 402 | + sprintf(  | 
                                                        |
| 403 | + esc_html__(  | 
                                                        |
| 404 | + 'The namespace for this manifest file has already been registered, choose a namespace other than %s',  | 
                                                        |
| 405 | + 'event_espresso'  | 
                                                        |
| 406 | + ),  | 
                                                        |
| 407 | + $namespace  | 
                                                        |
| 408 | + )  | 
                                                        |
| 409 | + );  | 
                                                        |
| 410 | + }  | 
                                                        |
| 411 | +		if (filter_var($url_base, FILTER_VALIDATE_URL) === false) { | 
                                                        |
| 412 | +			if (is_admin()) { | 
                                                        |
| 413 | + EE_Error::add_error(  | 
                                                        |
| 414 | + sprintf(  | 
                                                        |
| 415 | + esc_html__(  | 
                                                        |
| 416 | + 'The url given for %1$s assets is invalid. The url provided was: "%2$s". This usually happens when another plugin or theme on a site is using the "%3$s" filter or has an invalid url set for the "%4$s" constant',  | 
                                                        |
| 417 | + 'event_espresso'  | 
                                                        |
| 418 | + ),  | 
                                                        |
| 419 | + 'Event Espresso',  | 
                                                        |
| 420 | + $url_base,  | 
                                                        |
| 421 | + 'plugins_url',  | 
                                                        |
| 422 | + 'WP_PLUGIN_URL'  | 
                                                        |
| 423 | + ),  | 
                                                        |
| 424 | + __FILE__,  | 
                                                        |
| 425 | + __FUNCTION__,  | 
                                                        |
| 426 | + __LINE__  | 
                                                        |
| 427 | + );  | 
                                                        |
| 428 | + }  | 
                                                        |
| 429 | + return;  | 
                                                        |
| 430 | + }  | 
                                                        |
| 431 | + $this->manifest_data[$namespace] = $this->decodeManifestFile($manifest_file);  | 
                                                        |
| 432 | +		if (! isset($this->manifest_data[$namespace]['url_base'])) { | 
                                                        |
| 433 | + $this->manifest_data[$namespace]['url_base'] = trailingslashit($url_base);  | 
                                                        |
| 434 | + }  | 
                                                        |
| 435 | + }  | 
                                                        |
| 436 | +  | 
                                                        |
| 437 | +  | 
                                                        |
| 438 | +  | 
                                                        |
| 439 | + /**  | 
                                                        |
| 440 | + * Decodes json from the provided manifest file.  | 
                                                        |
| 441 | + *  | 
                                                        |
| 442 | + * @since 4.9.59.p  | 
                                                        |
| 443 | + * @param string $manifest_file Path to manifest file.  | 
                                                        |
| 444 | + * @return array  | 
                                                        |
| 445 | + * @throws InvalidFilePathException  | 
                                                        |
| 446 | + */  | 
                                                        |
| 447 | + private function decodeManifestFile($manifest_file)  | 
                                                        |
| 448 | +	{ | 
                                                        |
| 449 | +		if (! file_exists($manifest_file)) { | 
                                                        |
| 450 | + throw new InvalidFilePathException($manifest_file);  | 
                                                        |
| 451 | + }  | 
                                                        |
| 452 | + return json_decode(file_get_contents($manifest_file), true);  | 
                                                        |
| 453 | + }  | 
                                                        |
| 454 | +  | 
                                                        |
| 455 | +  | 
                                                        |
| 456 | +  | 
                                                        |
| 457 | + /**  | 
                                                        |
| 458 | + * Verifies whether the given data exists already on the jsdata array.  | 
                                                        |
| 459 | + * Overriding data is not allowed.  | 
                                                        |
| 460 | + *  | 
                                                        |
| 461 | + * @param string $key Index for data.  | 
                                                        |
| 462 | + * @return bool If valid then return true.  | 
                                                        |
| 463 | + * @throws InvalidArgumentException if data already exists.  | 
                                                        |
| 464 | + */  | 
                                                        |
| 465 | + protected function verifyDataNotExisting($key)  | 
                                                        |
| 466 | +	{ | 
                                                        |
| 467 | +		if (isset($this->jsdata[$key])) { | 
                                                        |
| 468 | +			if (is_array($this->jsdata[$key])) { | 
                                                        |
| 469 | + throw new InvalidArgumentException(  | 
                                                        |
| 470 | + sprintf(  | 
                                                        |
| 471 | + __(  | 
                                                        |
| 472 | + 'The value for %1$s already exists in the Registry::eejs object.  | 
                                                        |
| 473 | 473 | Overrides are not allowed. Since the value of this data is an array, you may want to use the  | 
                                                        
| 474 | 474 | %2$s method to push your value to the array.',  | 
                                                        
| 475 | - 'event_espresso'  | 
                                                        |
| 476 | - ),  | 
                                                        |
| 477 | - $key,  | 
                                                        |
| 478 | - 'pushData()'  | 
                                                        |
| 479 | - )  | 
                                                        |
| 480 | - );  | 
                                                        |
| 481 | - }  | 
                                                        |
| 482 | - throw new InvalidArgumentException(  | 
                                                        |
| 483 | - sprintf(  | 
                                                        |
| 484 | - __(  | 
                                                        |
| 485 | - 'The value for %1$s already exists in the Registry::eejs object. Overrides are not  | 
                                                        |
| 475 | + 'event_espresso'  | 
                                                        |
| 476 | + ),  | 
                                                        |
| 477 | + $key,  | 
                                                        |
| 478 | + 'pushData()'  | 
                                                        |
| 479 | + )  | 
                                                        |
| 480 | + );  | 
                                                        |
| 481 | + }  | 
                                                        |
| 482 | + throw new InvalidArgumentException(  | 
                                                        |
| 483 | + sprintf(  | 
                                                        |
| 484 | + __(  | 
                                                        |
| 485 | + 'The value for %1$s already exists in the Registry::eejs object. Overrides are not  | 
                                                        |
| 486 | 486 | allowed. Consider attaching your value to a different key',  | 
                                                        
| 487 | - 'event_espresso'  | 
                                                        |
| 488 | - ),  | 
                                                        |
| 489 | - $key  | 
                                                        |
| 490 | - )  | 
                                                        |
| 491 | - );  | 
                                                        |
| 492 | - }  | 
                                                        |
| 493 | - return true;  | 
                                                        |
| 494 | - }  | 
                                                        |
| 495 | -  | 
                                                        |
| 496 | -  | 
                                                        |
| 497 | -  | 
                                                        |
| 498 | - /**  | 
                                                        |
| 499 | - * registers core default stylesheets  | 
                                                        |
| 500 | - */  | 
                                                        |
| 501 | - private function loadCoreCss()  | 
                                                        |
| 502 | -    { | 
                                                        |
| 503 | -        if ($this->template_config->enable_default_style) { | 
                                                        |
| 504 | - $default_stylesheet_path = is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')  | 
                                                        |
| 505 | - ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css'  | 
                                                        |
| 506 | - : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css';  | 
                                                        |
| 507 | - wp_register_style(  | 
                                                        |
| 508 | - 'espresso_default',  | 
                                                        |
| 509 | - $default_stylesheet_path,  | 
                                                        |
| 510 | -                array('dashicons'), | 
                                                        |
| 511 | - EVENT_ESPRESSO_VERSION  | 
                                                        |
| 512 | - );  | 
                                                        |
| 513 | - //Load custom style sheet if available  | 
                                                        |
| 514 | -            if ($this->template_config->custom_style_sheet !== null) { | 
                                                        |
| 515 | - wp_register_style(  | 
                                                        |
| 516 | - 'espresso_custom_css',  | 
                                                        |
| 517 | - EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,  | 
                                                        |
| 518 | -                    array('espresso_default'), | 
                                                        |
| 519 | - EVENT_ESPRESSO_VERSION  | 
                                                        |
| 520 | - );  | 
                                                        |
| 521 | - }  | 
                                                        |
| 522 | - }  | 
                                                        |
| 523 | - }  | 
                                                        |
| 524 | -  | 
                                                        |
| 525 | -  | 
                                                        |
| 526 | -  | 
                                                        |
| 527 | - /**  | 
                                                        |
| 528 | - * registers core default javascript  | 
                                                        |
| 529 | - */  | 
                                                        |
| 530 | - private function loadCoreJs()  | 
                                                        |
| 531 | -    { | 
                                                        |
| 532 | - // load core js  | 
                                                        |
| 533 | - wp_register_script(  | 
                                                        |
| 534 | - 'espresso_core',  | 
                                                        |
| 535 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',  | 
                                                        |
| 536 | -            array('jquery'), | 
                                                        |
| 537 | - EVENT_ESPRESSO_VERSION,  | 
                                                        |
| 538 | - true  | 
                                                        |
| 539 | - );  | 
                                                        |
| 540 | - }  | 
                                                        |
| 541 | -  | 
                                                        |
| 542 | -  | 
                                                        |
| 543 | -  | 
                                                        |
| 544 | - /**  | 
                                                        |
| 545 | - * registers jQuery Validate for form validation  | 
                                                        |
| 546 | - */  | 
                                                        |
| 547 | - private function loadJqueryValidate()  | 
                                                        |
| 548 | -    { | 
                                                        |
| 549 | - // register jQuery Validate and additional methods  | 
                                                        |
| 550 | - wp_register_script(  | 
                                                        |
| 551 | - 'jquery-validate',  | 
                                                        |
| 552 | - EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',  | 
                                                        |
| 553 | -            array('jquery'), | 
                                                        |
| 554 | - '1.15.0',  | 
                                                        |
| 555 | - true  | 
                                                        |
| 556 | - );  | 
                                                        |
| 557 | - wp_register_script(  | 
                                                        |
| 558 | - 'jquery-validate-extra-methods',  | 
                                                        |
| 559 | - EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',  | 
                                                        |
| 560 | -            array('jquery', 'jquery-validate'), | 
                                                        |
| 561 | - '1.15.0',  | 
                                                        |
| 562 | - true  | 
                                                        |
| 563 | - );  | 
                                                        |
| 564 | - }  | 
                                                        |
| 565 | -  | 
                                                        |
| 566 | -  | 
                                                        |
| 567 | -  | 
                                                        |
| 568 | - /**  | 
                                                        |
| 569 | - * registers accounting.js for performing client-side calculations  | 
                                                        |
| 570 | - */  | 
                                                        |
| 571 | - private function loadAccountingJs()  | 
                                                        |
| 572 | -    { | 
                                                        |
| 573 | - //accounting.js library  | 
                                                        |
| 574 | - // @link http://josscrowcroft.github.io/accounting.js/  | 
                                                        |
| 575 | - wp_register_script(  | 
                                                        |
| 576 | - 'ee-accounting-core',  | 
                                                        |
| 577 | - EE_THIRD_PARTY_URL . 'accounting/accounting.js',  | 
                                                        |
| 578 | -            array('underscore'), | 
                                                        |
| 579 | - '0.3.2',  | 
                                                        |
| 580 | - true  | 
                                                        |
| 581 | - );  | 
                                                        |
| 582 | - wp_register_script(  | 
                                                        |
| 583 | - 'ee-accounting',  | 
                                                        |
| 584 | - EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',  | 
                                                        |
| 585 | -            array('ee-accounting-core'), | 
                                                        |
| 586 | - EVENT_ESPRESSO_VERSION,  | 
                                                        |
| 587 | - true  | 
                                                        |
| 588 | - );  | 
                                                        |
| 589 | - }  | 
                                                        |
| 590 | -  | 
                                                        |
| 591 | -  | 
                                                        |
| 592 | -  | 
                                                        |
| 593 | - /**  | 
                                                        |
| 594 | - * registers accounting.js for performing client-side calculations  | 
                                                        |
| 595 | - */  | 
                                                        |
| 596 | - private function localizeAccountingJs()  | 
                                                        |
| 597 | -    { | 
                                                        |
| 598 | - wp_localize_script(  | 
                                                        |
| 599 | - 'ee-accounting',  | 
                                                        |
| 600 | - 'EE_ACCOUNTING_CFG',  | 
                                                        |
| 601 | - array(  | 
                                                        |
| 602 | - 'currency' => array(  | 
                                                        |
| 603 | - 'symbol' => $this->currency_config->sign,  | 
                                                        |
| 604 | - 'format' => array(  | 
                                                        |
| 605 | - 'pos' => $this->currency_config->sign_b4 ? '%s%v' : '%v%s',  | 
                                                        |
| 606 | - 'neg' => $this->currency_config->sign_b4 ? '- %s%v' : '- %v%s',  | 
                                                        |
| 607 | - 'zero' => $this->currency_config->sign_b4 ? '%s--' : '--%s',  | 
                                                        |
| 608 | - ),  | 
                                                        |
| 609 | - 'decimal' => $this->currency_config->dec_mrk,  | 
                                                        |
| 610 | - 'thousand' => $this->currency_config->thsnds,  | 
                                                        |
| 611 | - 'precision' => $this->currency_config->dec_plc,  | 
                                                        |
| 612 | - ),  | 
                                                        |
| 613 | - 'number' => array(  | 
                                                        |
| 614 | - 'precision' => $this->currency_config->dec_plc,  | 
                                                        |
| 615 | - 'thousand' => $this->currency_config->thsnds,  | 
                                                        |
| 616 | - 'decimal' => $this->currency_config->dec_mrk,  | 
                                                        |
| 617 | - ),  | 
                                                        |
| 618 | - )  | 
                                                        |
| 619 | - );  | 
                                                        |
| 620 | -        $this->addRegisteredScriptHandlesWithData('ee-accounting'); | 
                                                        |
| 621 | - }  | 
                                                        |
| 622 | -  | 
                                                        |
| 623 | -  | 
                                                        |
| 624 | -  | 
                                                        |
| 625 | - /**  | 
                                                        |
| 626 | - * registers assets for cleaning your ears  | 
                                                        |
| 627 | - */  | 
                                                        |
| 628 | - private function loadQtipJs()  | 
                                                        |
| 629 | -    { | 
                                                        |
| 630 | - // qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook,  | 
                                                        |
| 631 | -        // can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' ); | 
                                                        |
| 632 | -        if (apply_filters('FHEE_load_qtip', false)) { | 
                                                        |
| 633 | - EEH_Qtip_Loader::instance()->register_and_enqueue();  | 
                                                        |
| 634 | - }  | 
                                                        |
| 635 | - }  | 
                                                        |
| 636 | -  | 
                                                        |
| 637 | -  | 
                                                        |
| 638 | - /**  | 
                                                        |
| 639 | - * This is used to set registered script handles that have data.  | 
                                                        |
| 640 | - * @param string $script_handle  | 
                                                        |
| 641 | - */  | 
                                                        |
| 642 | - private function addRegisteredScriptHandlesWithData($script_handle)  | 
                                                        |
| 643 | -    { | 
                                                        |
| 644 | - $this->script_handles_with_data[$script_handle] = $script_handle;  | 
                                                        |
| 645 | - }  | 
                                                        |
| 646 | -  | 
                                                        |
| 647 | -  | 
                                                        |
| 648 | - /**i  | 
                                                        |
| 487 | + 'event_espresso'  | 
                                                        |
| 488 | + ),  | 
                                                        |
| 489 | + $key  | 
                                                        |
| 490 | + )  | 
                                                        |
| 491 | + );  | 
                                                        |
| 492 | + }  | 
                                                        |
| 493 | + return true;  | 
                                                        |
| 494 | + }  | 
                                                        |
| 495 | +  | 
                                                        |
| 496 | +  | 
                                                        |
| 497 | +  | 
                                                        |
| 498 | + /**  | 
                                                        |
| 499 | + * registers core default stylesheets  | 
                                                        |
| 500 | + */  | 
                                                        |
| 501 | + private function loadCoreCss()  | 
                                                        |
| 502 | +	{ | 
                                                        |
| 503 | +		if ($this->template_config->enable_default_style) { | 
                                                        |
| 504 | + $default_stylesheet_path = is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')  | 
                                                        |
| 505 | + ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css'  | 
                                                        |
| 506 | + : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css';  | 
                                                        |
| 507 | + wp_register_style(  | 
                                                        |
| 508 | + 'espresso_default',  | 
                                                        |
| 509 | + $default_stylesheet_path,  | 
                                                        |
| 510 | +				array('dashicons'), | 
                                                        |
| 511 | + EVENT_ESPRESSO_VERSION  | 
                                                        |
| 512 | + );  | 
                                                        |
| 513 | + //Load custom style sheet if available  | 
                                                        |
| 514 | +			if ($this->template_config->custom_style_sheet !== null) { | 
                                                        |
| 515 | + wp_register_style(  | 
                                                        |
| 516 | + 'espresso_custom_css',  | 
                                                        |
| 517 | + EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,  | 
                                                        |
| 518 | +					array('espresso_default'), | 
                                                        |
| 519 | + EVENT_ESPRESSO_VERSION  | 
                                                        |
| 520 | + );  | 
                                                        |
| 521 | + }  | 
                                                        |
| 522 | + }  | 
                                                        |
| 523 | + }  | 
                                                        |
| 524 | +  | 
                                                        |
| 525 | +  | 
                                                        |
| 526 | +  | 
                                                        |
| 527 | + /**  | 
                                                        |
| 528 | + * registers core default javascript  | 
                                                        |
| 529 | + */  | 
                                                        |
| 530 | + private function loadCoreJs()  | 
                                                        |
| 531 | +	{ | 
                                                        |
| 532 | + // load core js  | 
                                                        |
| 533 | + wp_register_script(  | 
                                                        |
| 534 | + 'espresso_core',  | 
                                                        |
| 535 | + EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',  | 
                                                        |
| 536 | +			array('jquery'), | 
                                                        |
| 537 | + EVENT_ESPRESSO_VERSION,  | 
                                                        |
| 538 | + true  | 
                                                        |
| 539 | + );  | 
                                                        |
| 540 | + }  | 
                                                        |
| 541 | +  | 
                                                        |
| 542 | +  | 
                                                        |
| 543 | +  | 
                                                        |
| 544 | + /**  | 
                                                        |
| 545 | + * registers jQuery Validate for form validation  | 
                                                        |
| 546 | + */  | 
                                                        |
| 547 | + private function loadJqueryValidate()  | 
                                                        |
| 548 | +	{ | 
                                                        |
| 549 | + // register jQuery Validate and additional methods  | 
                                                        |
| 550 | + wp_register_script(  | 
                                                        |
| 551 | + 'jquery-validate',  | 
                                                        |
| 552 | + EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',  | 
                                                        |
| 553 | +			array('jquery'), | 
                                                        |
| 554 | + '1.15.0',  | 
                                                        |
| 555 | + true  | 
                                                        |
| 556 | + );  | 
                                                        |
| 557 | + wp_register_script(  | 
                                                        |
| 558 | + 'jquery-validate-extra-methods',  | 
                                                        |
| 559 | + EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',  | 
                                                        |
| 560 | +			array('jquery', 'jquery-validate'), | 
                                                        |
| 561 | + '1.15.0',  | 
                                                        |
| 562 | + true  | 
                                                        |
| 563 | + );  | 
                                                        |
| 564 | + }  | 
                                                        |
| 565 | +  | 
                                                        |
| 566 | +  | 
                                                        |
| 567 | +  | 
                                                        |
| 568 | + /**  | 
                                                        |
| 569 | + * registers accounting.js for performing client-side calculations  | 
                                                        |
| 570 | + */  | 
                                                        |
| 571 | + private function loadAccountingJs()  | 
                                                        |
| 572 | +	{ | 
                                                        |
| 573 | + //accounting.js library  | 
                                                        |
| 574 | + // @link http://josscrowcroft.github.io/accounting.js/  | 
                                                        |
| 575 | + wp_register_script(  | 
                                                        |
| 576 | + 'ee-accounting-core',  | 
                                                        |
| 577 | + EE_THIRD_PARTY_URL . 'accounting/accounting.js',  | 
                                                        |
| 578 | +			array('underscore'), | 
                                                        |
| 579 | + '0.3.2',  | 
                                                        |
| 580 | + true  | 
                                                        |
| 581 | + );  | 
                                                        |
| 582 | + wp_register_script(  | 
                                                        |
| 583 | + 'ee-accounting',  | 
                                                        |
| 584 | + EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',  | 
                                                        |
| 585 | +			array('ee-accounting-core'), | 
                                                        |
| 586 | + EVENT_ESPRESSO_VERSION,  | 
                                                        |
| 587 | + true  | 
                                                        |
| 588 | + );  | 
                                                        |
| 589 | + }  | 
                                                        |
| 590 | +  | 
                                                        |
| 591 | +  | 
                                                        |
| 592 | +  | 
                                                        |
| 593 | + /**  | 
                                                        |
| 594 | + * registers accounting.js for performing client-side calculations  | 
                                                        |
| 595 | + */  | 
                                                        |
| 596 | + private function localizeAccountingJs()  | 
                                                        |
| 597 | +	{ | 
                                                        |
| 598 | + wp_localize_script(  | 
                                                        |
| 599 | + 'ee-accounting',  | 
                                                        |
| 600 | + 'EE_ACCOUNTING_CFG',  | 
                                                        |
| 601 | + array(  | 
                                                        |
| 602 | + 'currency' => array(  | 
                                                        |
| 603 | + 'symbol' => $this->currency_config->sign,  | 
                                                        |
| 604 | + 'format' => array(  | 
                                                        |
| 605 | + 'pos' => $this->currency_config->sign_b4 ? '%s%v' : '%v%s',  | 
                                                        |
| 606 | + 'neg' => $this->currency_config->sign_b4 ? '- %s%v' : '- %v%s',  | 
                                                        |
| 607 | + 'zero' => $this->currency_config->sign_b4 ? '%s--' : '--%s',  | 
                                                        |
| 608 | + ),  | 
                                                        |
| 609 | + 'decimal' => $this->currency_config->dec_mrk,  | 
                                                        |
| 610 | + 'thousand' => $this->currency_config->thsnds,  | 
                                                        |
| 611 | + 'precision' => $this->currency_config->dec_plc,  | 
                                                        |
| 612 | + ),  | 
                                                        |
| 613 | + 'number' => array(  | 
                                                        |
| 614 | + 'precision' => $this->currency_config->dec_plc,  | 
                                                        |
| 615 | + 'thousand' => $this->currency_config->thsnds,  | 
                                                        |
| 616 | + 'decimal' => $this->currency_config->dec_mrk,  | 
                                                        |
| 617 | + ),  | 
                                                        |
| 618 | + )  | 
                                                        |
| 619 | + );  | 
                                                        |
| 620 | +		$this->addRegisteredScriptHandlesWithData('ee-accounting'); | 
                                                        |
| 621 | + }  | 
                                                        |
| 622 | +  | 
                                                        |
| 623 | +  | 
                                                        |
| 624 | +  | 
                                                        |
| 625 | + /**  | 
                                                        |
| 626 | + * registers assets for cleaning your ears  | 
                                                        |
| 627 | + */  | 
                                                        |
| 628 | + private function loadQtipJs()  | 
                                                        |
| 629 | +	{ | 
                                                        |
| 630 | + // qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook,  | 
                                                        |
| 631 | +		// can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' ); | 
                                                        |
| 632 | +		if (apply_filters('FHEE_load_qtip', false)) { | 
                                                        |
| 633 | + EEH_Qtip_Loader::instance()->register_and_enqueue();  | 
                                                        |
| 634 | + }  | 
                                                        |
| 635 | + }  | 
                                                        |
| 636 | +  | 
                                                        |
| 637 | +  | 
                                                        |
| 638 | + /**  | 
                                                        |
| 639 | + * This is used to set registered script handles that have data.  | 
                                                        |
| 640 | + * @param string $script_handle  | 
                                                        |
| 641 | + */  | 
                                                        |
| 642 | + private function addRegisteredScriptHandlesWithData($script_handle)  | 
                                                        |
| 643 | +	{ | 
                                                        |
| 644 | + $this->script_handles_with_data[$script_handle] = $script_handle;  | 
                                                        |
| 645 | + }  | 
                                                        |
| 646 | +  | 
                                                        |
| 647 | +  | 
                                                        |
| 648 | + /**i  | 
                                                        |
| 649 | 649 | * Checks WP_Scripts for all of each script handle registered internally as having data and unsets from the  | 
                                                        
| 650 | 650 | * Dependency stored in WP_Scripts if its set.  | 
                                                        
| 651 | 651 | */  | 
                                                        
| 652 | - private function removeAlreadyRegisteredDataForScriptHandles()  | 
                                                        |
| 653 | -    { | 
                                                        |
| 654 | -        if (empty($this->script_handles_with_data)) { | 
                                                        |
| 655 | - return;  | 
                                                        |
| 656 | - }  | 
                                                        |
| 657 | -        foreach ($this->script_handles_with_data as $script_handle) { | 
                                                        |
| 658 | - $this->removeAlreadyRegisteredDataForScriptHandle($script_handle);  | 
                                                        |
| 659 | - }  | 
                                                        |
| 660 | - }  | 
                                                        |
| 661 | -  | 
                                                        |
| 662 | -  | 
                                                        |
| 663 | - /**  | 
                                                        |
| 664 | - * Removes any data dependency registered in WP_Scripts if its set.  | 
                                                        |
| 665 | - * @param string $script_handle  | 
                                                        |
| 666 | - */  | 
                                                        |
| 667 | - private function removeAlreadyRegisteredDataForScriptHandle($script_handle)  | 
                                                        |
| 668 | -    { | 
                                                        |
| 669 | -        if (isset($this->script_handles_with_data[$script_handle])) { | 
                                                        |
| 670 | - global $wp_scripts;  | 
                                                        |
| 671 | - $unset_handle = false;  | 
                                                        |
| 672 | -            if ($wp_scripts->get_data($script_handle, 'data')) { | 
                                                        |
| 673 | - unset($wp_scripts->registered[$script_handle]->extra['data']);  | 
                                                        |
| 674 | - $unset_handle = true;  | 
                                                        |
| 675 | - }  | 
                                                        |
| 676 | - //deal with inline_scripts  | 
                                                        |
| 677 | -            if ($wp_scripts->get_data($script_handle, 'before')) { | 
                                                        |
| 678 | - unset($wp_scripts->registered[$script_handle]->extra['before']);  | 
                                                        |
| 679 | - $unset_handle = true;  | 
                                                        |
| 680 | - }  | 
                                                        |
| 681 | -            if ($wp_scripts->get_data($script_handle, 'after')) { | 
                                                        |
| 682 | - unset($wp_scripts->registered[$script_handle]->extra['after']);  | 
                                                        |
| 683 | - }  | 
                                                        |
| 684 | -            if ($unset_handle) { | 
                                                        |
| 685 | - unset($this->script_handles_with_data[$script_handle]);  | 
                                                        |
| 686 | - }  | 
                                                        |
| 687 | - }  | 
                                                        |
| 688 | - }  | 
                                                        |
| 689 | -  | 
                                                        |
| 690 | -  | 
                                                        |
| 691 | - /**  | 
                                                        |
| 692 | - * Registers assets that are used in the WordPress admin.  | 
                                                        |
| 693 | - */  | 
                                                        |
| 694 | - private function registerAdminAssets()  | 
                                                        |
| 695 | -    { | 
                                                        |
| 696 | - wp_register_script(  | 
                                                        |
| 697 | - 'ee-wp-plugins-page',  | 
                                                        |
| 698 | - $this->getJsUrl(self::ASSET_NAMESPACE, 'wp-plugins-page'),  | 
                                                        |
| 699 | - array(  | 
                                                        |
| 700 | - 'jquery',  | 
                                                        |
| 701 | - 'ee-vendor-react'  | 
                                                        |
| 702 | - ),  | 
                                                        |
| 703 | - null,  | 
                                                        |
| 704 | - true  | 
                                                        |
| 705 | - );  | 
                                                        |
| 706 | - wp_register_style(  | 
                                                        |
| 707 | - 'ee-wp-plugins-page',  | 
                                                        |
| 708 | - $this->getCssUrl(self::ASSET_NAMESPACE, 'wp-plugins-page'),  | 
                                                        |
| 709 | - array(),  | 
                                                        |
| 710 | - null  | 
                                                        |
| 711 | - );  | 
                                                        |
| 712 | -        $this->registerTranslationsForHandles(array('ee-wp-plugins-page')); | 
                                                        |
| 713 | - }  | 
                                                        |
| 714 | -  | 
                                                        |
| 715 | -  | 
                                                        |
| 716 | - /**  | 
                                                        |
| 717 | - * All handles that are registered via the registry that might have translations have their translations registered  | 
                                                        |
| 718 | - *  | 
                                                        |
| 719 | - * @param array $handles_to_register  | 
                                                        |
| 720 | - */  | 
                                                        |
| 721 | - private function registerTranslationsForHandles(array $handles_to_register)  | 
                                                        |
| 722 | -    { | 
                                                        |
| 723 | -        foreach($handles_to_register as $handle) { | 
                                                        |
| 724 | - $this->i18n_registry->registerScriptI18n($handle);  | 
                                                        |
| 725 | - }  | 
                                                        |
| 726 | - }  | 
                                                        |
| 652 | + private function removeAlreadyRegisteredDataForScriptHandles()  | 
                                                        |
| 653 | +	{ | 
                                                        |
| 654 | +		if (empty($this->script_handles_with_data)) { | 
                                                        |
| 655 | + return;  | 
                                                        |
| 656 | + }  | 
                                                        |
| 657 | +		foreach ($this->script_handles_with_data as $script_handle) { | 
                                                        |
| 658 | + $this->removeAlreadyRegisteredDataForScriptHandle($script_handle);  | 
                                                        |
| 659 | + }  | 
                                                        |
| 660 | + }  | 
                                                        |
| 661 | +  | 
                                                        |
| 662 | +  | 
                                                        |
| 663 | + /**  | 
                                                        |
| 664 | + * Removes any data dependency registered in WP_Scripts if its set.  | 
                                                        |
| 665 | + * @param string $script_handle  | 
                                                        |
| 666 | + */  | 
                                                        |
| 667 | + private function removeAlreadyRegisteredDataForScriptHandle($script_handle)  | 
                                                        |
| 668 | +	{ | 
                                                        |
| 669 | +		if (isset($this->script_handles_with_data[$script_handle])) { | 
                                                        |
| 670 | + global $wp_scripts;  | 
                                                        |
| 671 | + $unset_handle = false;  | 
                                                        |
| 672 | +			if ($wp_scripts->get_data($script_handle, 'data')) { | 
                                                        |
| 673 | + unset($wp_scripts->registered[$script_handle]->extra['data']);  | 
                                                        |
| 674 | + $unset_handle = true;  | 
                                                        |
| 675 | + }  | 
                                                        |
| 676 | + //deal with inline_scripts  | 
                                                        |
| 677 | +			if ($wp_scripts->get_data($script_handle, 'before')) { | 
                                                        |
| 678 | + unset($wp_scripts->registered[$script_handle]->extra['before']);  | 
                                                        |
| 679 | + $unset_handle = true;  | 
                                                        |
| 680 | + }  | 
                                                        |
| 681 | +			if ($wp_scripts->get_data($script_handle, 'after')) { | 
                                                        |
| 682 | + unset($wp_scripts->registered[$script_handle]->extra['after']);  | 
                                                        |
| 683 | + }  | 
                                                        |
| 684 | +			if ($unset_handle) { | 
                                                        |
| 685 | + unset($this->script_handles_with_data[$script_handle]);  | 
                                                        |
| 686 | + }  | 
                                                        |
| 687 | + }  | 
                                                        |
| 688 | + }  | 
                                                        |
| 689 | +  | 
                                                        |
| 690 | +  | 
                                                        |
| 691 | + /**  | 
                                                        |
| 692 | + * Registers assets that are used in the WordPress admin.  | 
                                                        |
| 693 | + */  | 
                                                        |
| 694 | + private function registerAdminAssets()  | 
                                                        |
| 695 | +	{ | 
                                                        |
| 696 | + wp_register_script(  | 
                                                        |
| 697 | + 'ee-wp-plugins-page',  | 
                                                        |
| 698 | + $this->getJsUrl(self::ASSET_NAMESPACE, 'wp-plugins-page'),  | 
                                                        |
| 699 | + array(  | 
                                                        |
| 700 | + 'jquery',  | 
                                                        |
| 701 | + 'ee-vendor-react'  | 
                                                        |
| 702 | + ),  | 
                                                        |
| 703 | + null,  | 
                                                        |
| 704 | + true  | 
                                                        |
| 705 | + );  | 
                                                        |
| 706 | + wp_register_style(  | 
                                                        |
| 707 | + 'ee-wp-plugins-page',  | 
                                                        |
| 708 | + $this->getCssUrl(self::ASSET_NAMESPACE, 'wp-plugins-page'),  | 
                                                        |
| 709 | + array(),  | 
                                                        |
| 710 | + null  | 
                                                        |
| 711 | + );  | 
                                                        |
| 712 | +		$this->registerTranslationsForHandles(array('ee-wp-plugins-page')); | 
                                                        |
| 713 | + }  | 
                                                        |
| 714 | +  | 
                                                        |
| 715 | +  | 
                                                        |
| 716 | + /**  | 
                                                        |
| 717 | + * All handles that are registered via the registry that might have translations have their translations registered  | 
                                                        |
| 718 | + *  | 
                                                        |
| 719 | + * @param array $handles_to_register  | 
                                                        |
| 720 | + */  | 
                                                        |
| 721 | + private function registerTranslationsForHandles(array $handles_to_register)  | 
                                                        |
| 722 | +	{ | 
                                                        |
| 723 | +		foreach($handles_to_register as $handle) { | 
                                                        |
| 724 | + $this->i18n_registry->registerScriptI18n($handle);  | 
                                                        |
| 725 | + }  | 
                                                        |
| 726 | + }  | 
                                                        |
| 727 | 727 | }  | 
                                                        
@@ -113,7 +113,7 @@ discard block  | 
                                                    ||
| 113 | 113 | $this->registerManifestFile(  | 
                                                        
| 114 | 114 | self::ASSET_NAMESPACE,  | 
                                                        
| 115 | 115 | $this->domain->distributionAssetsUrl(),  | 
                                                        
| 116 | - $this->domain->distributionAssetsPath() . 'build-manifest.json'  | 
                                                        |
| 116 | + $this->domain->distributionAssetsPath().'build-manifest.json'  | 
                                                        |
| 117 | 117 | );  | 
                                                        
| 118 | 118 |          add_action('wp_enqueue_scripts', array($this, 'scripts'), 1); | 
                                                        
| 119 | 119 |          add_action('admin_enqueue_scripts', array($this, 'scripts'), 1); | 
                                                        
@@ -170,7 +170,7 @@ discard block  | 
                                                    ||
| 170 | 170 | //js.api  | 
                                                        
| 171 | 171 | wp_register_script(  | 
                                                        
| 172 | 172 | 'eejs-api',  | 
                                                        
| 173 | - EE_LIBRARIES_URL . 'rest_api/assets/js/eejs-api.min.js',  | 
                                                        |
| 173 | + EE_LIBRARIES_URL.'rest_api/assets/js/eejs-api.min.js',  | 
                                                        |
| 174 | 174 |                  array('underscore', 'eejs-core'), | 
                                                        
| 175 | 175 | EVENT_ESPRESSO_VERSION,  | 
                                                        
| 176 | 176 | true  | 
                                                        
@@ -178,7 +178,7 @@ discard block  | 
                                                    ||
| 178 | 178 |              $this->jsdata['eejs_api_nonce'] = wp_create_nonce('wp_rest'); | 
                                                        
| 179 | 179 |              $this->jsdata['paths'] = array('rest_route' => rest_url('ee/v4.8.36/')); | 
                                                        
| 180 | 180 | }  | 
                                                        
| 181 | -        if (! is_admin()) { | 
                                                        |
| 181 | +        if ( ! is_admin()) { | 
                                                        |
| 182 | 182 | $this->loadCoreCss();  | 
                                                        
| 183 | 183 | }  | 
                                                        
| 184 | 184 |          $this->registerTranslationsForHandles(array('eejs-core')); | 
                                                        
@@ -202,7 +202,7 @@ discard block  | 
                                                    ||
| 202 | 202 | $this->removeAlreadyRegisteredDataForScriptHandles();  | 
                                                        
| 203 | 203 | wp_add_inline_script(  | 
                                                        
| 204 | 204 | 'eejs-core',  | 
                                                        
| 205 | -            'var eejsdata=' . wp_json_encode(array('data' => $this->jsdata)), | 
                                                        |
| 205 | +            'var eejsdata='.wp_json_encode(array('data' => $this->jsdata)), | 
                                                        |
| 206 | 206 | 'before'  | 
                                                        
| 207 | 207 | );  | 
                                                        
| 208 | 208 |          wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); | 
                                                        
@@ -281,7 +281,7 @@ discard block  | 
                                                    ||
| 281 | 281 | */  | 
                                                        
| 282 | 282 | public function addTemplate($template_reference, $template_content)  | 
                                                        
| 283 | 283 |      { | 
                                                        
| 284 | -        if (! isset($this->jsdata['templates'])) { | 
                                                        |
| 284 | +        if ( ! isset($this->jsdata['templates'])) { | 
                                                        |
| 285 | 285 | $this->jsdata['templates'] = array();  | 
                                                        
| 286 | 286 | }  | 
                                                        
| 287 | 287 | //no overrides allowed.  | 
                                                        
@@ -429,7 +429,7 @@ discard block  | 
                                                    ||
| 429 | 429 | return;  | 
                                                        
| 430 | 430 | }  | 
                                                        
| 431 | 431 | $this->manifest_data[$namespace] = $this->decodeManifestFile($manifest_file);  | 
                                                        
| 432 | -        if (! isset($this->manifest_data[$namespace]['url_base'])) { | 
                                                        |
| 432 | +        if ( ! isset($this->manifest_data[$namespace]['url_base'])) { | 
                                                        |
| 433 | 433 | $this->manifest_data[$namespace]['url_base'] = trailingslashit($url_base);  | 
                                                        
| 434 | 434 | }  | 
                                                        
| 435 | 435 | }  | 
                                                        
@@ -446,7 +446,7 @@ discard block  | 
                                                    ||
| 446 | 446 | */  | 
                                                        
| 447 | 447 | private function decodeManifestFile($manifest_file)  | 
                                                        
| 448 | 448 |      { | 
                                                        
| 449 | -        if (! file_exists($manifest_file)) { | 
                                                        |
| 449 | +        if ( ! file_exists($manifest_file)) { | 
                                                        |
| 450 | 450 | throw new InvalidFilePathException($manifest_file);  | 
                                                        
| 451 | 451 | }  | 
                                                        
| 452 | 452 | return json_decode(file_get_contents($manifest_file), true);  | 
                                                        
@@ -501,9 +501,9 @@ discard block  | 
                                                    ||
| 501 | 501 | private function loadCoreCss()  | 
                                                        
| 502 | 502 |      { | 
                                                        
| 503 | 503 |          if ($this->template_config->enable_default_style) { | 
                                                        
| 504 | - $default_stylesheet_path = is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')  | 
                                                        |
| 504 | + $default_stylesheet_path = is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')  | 
                                                        |
| 505 | 505 | ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css'  | 
                                                        
| 506 | - : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css';  | 
                                                        |
| 506 | + : EE_GLOBAL_ASSETS_URL.'css/espresso_default.css';  | 
                                                        |
| 507 | 507 | wp_register_style(  | 
                                                        
| 508 | 508 | 'espresso_default',  | 
                                                        
| 509 | 509 | $default_stylesheet_path,  | 
                                                        
@@ -514,7 +514,7 @@ discard block  | 
                                                    ||
| 514 | 514 |              if ($this->template_config->custom_style_sheet !== null) { | 
                                                        
| 515 | 515 | wp_register_style(  | 
                                                        
| 516 | 516 | 'espresso_custom_css',  | 
                                                        
| 517 | - EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,  | 
                                                        |
| 517 | + EVENT_ESPRESSO_UPLOAD_URL.'css/'.$this->template_config->custom_style_sheet,  | 
                                                        |
| 518 | 518 |                      array('espresso_default'), | 
                                                        
| 519 | 519 | EVENT_ESPRESSO_VERSION  | 
                                                        
| 520 | 520 | );  | 
                                                        
@@ -532,7 +532,7 @@ discard block  | 
                                                    ||
| 532 | 532 | // load core js  | 
                                                        
| 533 | 533 | wp_register_script(  | 
                                                        
| 534 | 534 | 'espresso_core',  | 
                                                        
| 535 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',  | 
                                                        |
| 535 | + EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js',  | 
                                                        |
| 536 | 536 |              array('jquery'), | 
                                                        
| 537 | 537 | EVENT_ESPRESSO_VERSION,  | 
                                                        
| 538 | 538 | true  | 
                                                        
@@ -549,14 +549,14 @@ discard block  | 
                                                    ||
| 549 | 549 | // register jQuery Validate and additional methods  | 
                                                        
| 550 | 550 | wp_register_script(  | 
                                                        
| 551 | 551 | 'jquery-validate',  | 
                                                        
| 552 | - EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',  | 
                                                        |
| 552 | + EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js',  | 
                                                        |
| 553 | 553 |              array('jquery'), | 
                                                        
| 554 | 554 | '1.15.0',  | 
                                                        
| 555 | 555 | true  | 
                                                        
| 556 | 556 | );  | 
                                                        
| 557 | 557 | wp_register_script(  | 
                                                        
| 558 | 558 | 'jquery-validate-extra-methods',  | 
                                                        
| 559 | - EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',  | 
                                                        |
| 559 | + EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.additional-methods.min.js',  | 
                                                        |
| 560 | 560 |              array('jquery', 'jquery-validate'), | 
                                                        
| 561 | 561 | '1.15.0',  | 
                                                        
| 562 | 562 | true  | 
                                                        
@@ -574,14 +574,14 @@ discard block  | 
                                                    ||
| 574 | 574 | // @link http://josscrowcroft.github.io/accounting.js/  | 
                                                        
| 575 | 575 | wp_register_script(  | 
                                                        
| 576 | 576 | 'ee-accounting-core',  | 
                                                        
| 577 | - EE_THIRD_PARTY_URL . 'accounting/accounting.js',  | 
                                                        |
| 577 | + EE_THIRD_PARTY_URL.'accounting/accounting.js',  | 
                                                        |
| 578 | 578 |              array('underscore'), | 
                                                        
| 579 | 579 | '0.3.2',  | 
                                                        
| 580 | 580 | true  | 
                                                        
| 581 | 581 | );  | 
                                                        
| 582 | 582 | wp_register_script(  | 
                                                        
| 583 | 583 | 'ee-accounting',  | 
                                                        
| 584 | - EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',  | 
                                                        |
| 584 | + EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js',  | 
                                                        |
| 585 | 585 |              array('ee-accounting-core'), | 
                                                        
| 586 | 586 | EVENT_ESPRESSO_VERSION,  | 
                                                        
| 587 | 587 | true  | 
                                                        
@@ -720,7 +720,7 @@ discard block  | 
                                                    ||
| 720 | 720 | */  | 
                                                        
| 721 | 721 | private function registerTranslationsForHandles(array $handles_to_register)  | 
                                                        
| 722 | 722 |      { | 
                                                        
| 723 | -        foreach($handles_to_register as $handle) { | 
                                                        |
| 723 | +        foreach ($handles_to_register as $handle) { | 
                                                        |
| 724 | 724 | $this->i18n_registry->registerScriptI18n($handle);  | 
                                                        
| 725 | 725 | }  | 
                                                        
| 726 | 726 | }  | 
                                                        
@@ -38,103 +38,103 @@  | 
                                                    ||
| 38 | 38 | * @since 4.0  | 
                                                        
| 39 | 39 | */  | 
                                                        
| 40 | 40 |  if (function_exists('espresso_version')) { | 
                                                        
| 41 | -    if (! function_exists('espresso_duplicate_plugin_error')) { | 
                                                        |
| 42 | - /**  | 
                                                        |
| 43 | - * espresso_duplicate_plugin_error  | 
                                                        |
| 44 | - * displays if more than one version of EE is activated at the same time  | 
                                                        |
| 45 | - */  | 
                                                        |
| 46 | - function espresso_duplicate_plugin_error()  | 
                                                        |
| 47 | -        { | 
                                                        |
| 48 | - ?>  | 
                                                        |
| 41 | +	if (! function_exists('espresso_duplicate_plugin_error')) { | 
                                                        |
| 42 | + /**  | 
                                                        |
| 43 | + * espresso_duplicate_plugin_error  | 
                                                        |
| 44 | + * displays if more than one version of EE is activated at the same time  | 
                                                        |
| 45 | + */  | 
                                                        |
| 46 | + function espresso_duplicate_plugin_error()  | 
                                                        |
| 47 | +		{ | 
                                                        |
| 48 | + ?>  | 
                                                        |
| 49 | 49 | <div class="error">  | 
                                                        
| 50 | 50 | <p>  | 
                                                        
| 51 | 51 | <?php  | 
                                                        
| 52 | - echo esc_html__(  | 
                                                        |
| 53 | - '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.',  | 
                                                        |
| 54 | - 'event_espresso'  | 
                                                        |
| 55 | - ); ?>  | 
                                                        |
| 52 | + echo esc_html__(  | 
                                                        |
| 53 | + '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.',  | 
                                                        |
| 54 | + 'event_espresso'  | 
                                                        |
| 55 | + ); ?>  | 
                                                        |
| 56 | 56 | </p>  | 
                                                        
| 57 | 57 | </div>  | 
                                                        
| 58 | 58 | <?php  | 
                                                        
| 59 | - espresso_deactivate_plugin(plugin_basename(__FILE__));  | 
                                                        |
| 60 | - }  | 
                                                        |
| 61 | - }  | 
                                                        |
| 62 | -    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); | 
                                                        |
| 59 | + espresso_deactivate_plugin(plugin_basename(__FILE__));  | 
                                                        |
| 60 | + }  | 
                                                        |
| 61 | + }  | 
                                                        |
| 62 | +	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); | 
                                                        |
| 63 | 63 | |
| 64 | 64 |  } else { | 
                                                        
| 65 | -    define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); | 
                                                        |
| 66 | -    if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { | 
                                                        |
| 67 | - /**  | 
                                                        |
| 68 | - * espresso_minimum_php_version_error  | 
                                                        |
| 69 | - * @return void  | 
                                                        |
| 70 | - */  | 
                                                        |
| 71 | - function espresso_minimum_php_version_error()  | 
                                                        |
| 72 | -        { | 
                                                        |
| 73 | - ?>  | 
                                                        |
| 65 | +	define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); | 
                                                        |
| 66 | +	if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { | 
                                                        |
| 67 | + /**  | 
                                                        |
| 68 | + * espresso_minimum_php_version_error  | 
                                                        |
| 69 | + * @return void  | 
                                                        |
| 70 | + */  | 
                                                        |
| 71 | + function espresso_minimum_php_version_error()  | 
                                                        |
| 72 | +		{ | 
                                                        |
| 73 | + ?>  | 
                                                        |
| 74 | 74 | <div class="error">  | 
                                                        
| 75 | 75 | <p>  | 
                                                        
| 76 | 76 | <?php  | 
                                                        
| 77 | - printf(  | 
                                                        |
| 78 | - esc_html__(  | 
                                                        |
| 79 | - '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.',  | 
                                                        |
| 80 | - 'event_espresso'  | 
                                                        |
| 81 | - ),  | 
                                                        |
| 82 | - EE_MIN_PHP_VER_REQUIRED,  | 
                                                        |
| 83 | - PHP_VERSION,  | 
                                                        |
| 84 | - '<br/>',  | 
                                                        |
| 85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'  | 
                                                        |
| 86 | - );  | 
                                                        |
| 87 | - ?>  | 
                                                        |
| 77 | + printf(  | 
                                                        |
| 78 | + esc_html__(  | 
                                                        |
| 79 | + '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.',  | 
                                                        |
| 80 | + 'event_espresso'  | 
                                                        |
| 81 | + ),  | 
                                                        |
| 82 | + EE_MIN_PHP_VER_REQUIRED,  | 
                                                        |
| 83 | + PHP_VERSION,  | 
                                                        |
| 84 | + '<br/>',  | 
                                                        |
| 85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'  | 
                                                        |
| 86 | + );  | 
                                                        |
| 87 | + ?>  | 
                                                        |
| 88 | 88 | </p>  | 
                                                        
| 89 | 89 | </div>  | 
                                                        
| 90 | 90 | <?php  | 
                                                        
| 91 | - espresso_deactivate_plugin(plugin_basename(__FILE__));  | 
                                                        |
| 92 | - }  | 
                                                        |
| 91 | + espresso_deactivate_plugin(plugin_basename(__FILE__));  | 
                                                        |
| 92 | + }  | 
                                                        |
| 93 | 93 | |
| 94 | -        add_action('admin_notices', 'espresso_minimum_php_version_error', 1); | 
                                                        |
| 95 | -    } else { | 
                                                        |
| 96 | -        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); | 
                                                        |
| 97 | - /**  | 
                                                        |
| 98 | - * espresso_version  | 
                                                        |
| 99 | - * Returns the plugin version  | 
                                                        |
| 100 | - *  | 
                                                        |
| 101 | - * @return string  | 
                                                        |
| 102 | - */  | 
                                                        |
| 103 | - function espresso_version()  | 
                                                        |
| 104 | -        { | 
                                                        |
| 105 | -            return apply_filters('FHEE__espresso__espresso_version', '4.9.62.rc.010'); | 
                                                        |
| 106 | - }  | 
                                                        |
| 94 | +		add_action('admin_notices', 'espresso_minimum_php_version_error', 1); | 
                                                        |
| 95 | +	} else { | 
                                                        |
| 96 | +		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); | 
                                                        |
| 97 | + /**  | 
                                                        |
| 98 | + * espresso_version  | 
                                                        |
| 99 | + * Returns the plugin version  | 
                                                        |
| 100 | + *  | 
                                                        |
| 101 | + * @return string  | 
                                                        |
| 102 | + */  | 
                                                        |
| 103 | + function espresso_version()  | 
                                                        |
| 104 | +		{ | 
                                                        |
| 105 | +			return apply_filters('FHEE__espresso__espresso_version', '4.9.62.rc.010'); | 
                                                        |
| 106 | + }  | 
                                                        |
| 107 | 107 | |
| 108 | - /**  | 
                                                        |
| 109 | - * espresso_plugin_activation  | 
                                                        |
| 110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page  | 
                                                        |
| 111 | - */  | 
                                                        |
| 112 | - function espresso_plugin_activation()  | 
                                                        |
| 113 | -        { | 
                                                        |
| 114 | -            update_option('ee_espresso_activation', true); | 
                                                        |
| 115 | - }  | 
                                                        |
| 108 | + /**  | 
                                                        |
| 109 | + * espresso_plugin_activation  | 
                                                        |
| 110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page  | 
                                                        |
| 111 | + */  | 
                                                        |
| 112 | + function espresso_plugin_activation()  | 
                                                        |
| 113 | +		{ | 
                                                        |
| 114 | +			update_option('ee_espresso_activation', true); | 
                                                        |
| 115 | + }  | 
                                                        |
| 116 | 116 | |
| 117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');  | 
                                                        |
| 117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');  | 
                                                        |
| 118 | 118 | |
| 119 | - require_once __DIR__ . '/core/bootstrap_espresso.php';  | 
                                                        |
| 120 | - bootstrap_espresso();  | 
                                                        |
| 121 | - }  | 
                                                        |
| 119 | + require_once __DIR__ . '/core/bootstrap_espresso.php';  | 
                                                        |
| 120 | + bootstrap_espresso();  | 
                                                        |
| 121 | + }  | 
                                                        |
| 122 | 122 | }  | 
                                                        
| 123 | 123 |  if (! function_exists('espresso_deactivate_plugin')) { | 
                                                        
| 124 | - /**  | 
                                                        |
| 125 | - * deactivate_plugin  | 
                                                        |
| 126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ ));  | 
                                                        |
| 127 | - *  | 
                                                        |
| 128 | - * @access public  | 
                                                        |
| 129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file  | 
                                                        |
| 130 | - * @return void  | 
                                                        |
| 131 | - */  | 
                                                        |
| 132 | - function espresso_deactivate_plugin($plugin_basename = '')  | 
                                                        |
| 133 | -    { | 
                                                        |
| 134 | -        if (! function_exists('deactivate_plugins')) { | 
                                                        |
| 135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php';  | 
                                                        |
| 136 | - }  | 
                                                        |
| 137 | - unset($_GET['activate'], $_REQUEST['activate']);  | 
                                                        |
| 138 | - deactivate_plugins($plugin_basename);  | 
                                                        |
| 139 | - }  | 
                                                        |
| 124 | + /**  | 
                                                        |
| 125 | + * deactivate_plugin  | 
                                                        |
| 126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ ));  | 
                                                        |
| 127 | + *  | 
                                                        |
| 128 | + * @access public  | 
                                                        |
| 129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file  | 
                                                        |
| 130 | + * @return void  | 
                                                        |
| 131 | + */  | 
                                                        |
| 132 | + function espresso_deactivate_plugin($plugin_basename = '')  | 
                                                        |
| 133 | +	{ | 
                                                        |
| 134 | +		if (! function_exists('deactivate_plugins')) { | 
                                                        |
| 135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php';  | 
                                                        |
| 136 | + }  | 
                                                        |
| 137 | + unset($_GET['activate'], $_REQUEST['activate']);  | 
                                                        |
| 138 | + deactivate_plugins($plugin_basename);  | 
                                                        |
| 139 | + }  | 
                                                        |
| 140 | 140 | }  | 
                                                        
@@ -20,113 +20,113 @@  | 
                                                    ||
| 20 | 20 | class ObjectIdentifier  | 
                                                        
| 21 | 21 |  { | 
                                                        
| 22 | 22 | |
| 23 | - /**  | 
                                                        |
| 24 | - * used to separate the FQCN from the class's arguments identifier  | 
                                                        |
| 25 | - */  | 
                                                        |
| 26 | - const DELIMITER = '____';  | 
                                                        |
| 27 | -  | 
                                                        |
| 28 | - /**  | 
                                                        |
| 29 | - * @var ClassInterfaceCache $class_cache  | 
                                                        |
| 30 | - */  | 
                                                        |
| 31 | - private $class_cache;  | 
                                                        |
| 32 | -  | 
                                                        |
| 33 | -  | 
                                                        |
| 34 | - /**  | 
                                                        |
| 35 | - * ObjectIdentifier constructor.  | 
                                                        |
| 36 | - *  | 
                                                        |
| 37 | - * @param ClassInterfaceCache $class_cache  | 
                                                        |
| 38 | - */  | 
                                                        |
| 39 | - public function __construct(ClassInterfaceCache $class_cache)  | 
                                                        |
| 40 | -    { | 
                                                        |
| 41 | - $this->class_cache = $class_cache;  | 
                                                        |
| 42 | - }  | 
                                                        |
| 43 | -  | 
                                                        |
| 44 | -  | 
                                                        |
| 45 | - /**  | 
                                                        |
| 46 | - * Returns true if the supplied $object_identifier contains  | 
                                                        |
| 47 | - * the delimiter used to separate an fqcn from the arguments hash  | 
                                                        |
| 48 | - *  | 
                                                        |
| 49 | - * @param string $object_identifier  | 
                                                        |
| 50 | - * @return bool  | 
                                                        |
| 51 | - */  | 
                                                        |
| 52 | - public function hasArguments($object_identifier)  | 
                                                        |
| 53 | -    { | 
                                                        |
| 54 | - // type casting to bool instead of using strpos() !== false  | 
                                                        |
| 55 | - // because an object identifier should never begin with the delimiter  | 
                                                        |
| 56 | - // therefore the delimiter should NOT be found at position 0  | 
                                                        |
| 57 | - return (bool) strpos($object_identifier, ObjectIdentifier::DELIMITER);  | 
                                                        |
| 58 | - }  | 
                                                        |
| 59 | -  | 
                                                        |
| 60 | -  | 
                                                        |
| 61 | - /**  | 
                                                        |
| 62 | - * Returns true if the supplied FQCN equals the supplied $object_identifier  | 
                                                        |
| 63 | - * OR the supplied FQCN matches the FQCN portion of the supplied $object_identifier  | 
                                                        |
| 64 | - * AND that $object_identifier is for an object with arguments.  | 
                                                        |
| 65 | - * This allows a request for an object using a FQCN to match  | 
                                                        |
| 66 | - * a previously instantiated object with arguments  | 
                                                        |
| 67 | - * without having to know those arguments.  | 
                                                        |
| 68 | - *  | 
                                                        |
| 69 | - * @param string $fqcn  | 
                                                        |
| 70 | - * @param string $object_identifier  | 
                                                        |
| 71 | - * @return bool  | 
                                                        |
| 72 | - */  | 
                                                        |
| 73 | - public function fqcnMatchesObjectIdentifier($fqcn, $object_identifier)  | 
                                                        |
| 74 | -    { | 
                                                        |
| 75 | - return $fqcn === $object_identifier  | 
                                                        |
| 76 | - || strpos($object_identifier, $fqcn . ObjectIdentifier::DELIMITER) === 0;  | 
                                                        |
| 77 | - }  | 
                                                        |
| 78 | -  | 
                                                        |
| 79 | -  | 
                                                        |
| 80 | - /**  | 
                                                        |
| 81 | - * build a string representation of an object's FQCN and arguments  | 
                                                        |
| 82 | - *  | 
                                                        |
| 83 | - * @param string $fqcn  | 
                                                        |
| 84 | - * @param array $arguments  | 
                                                        |
| 85 | - * @return string  | 
                                                        |
| 86 | - */  | 
                                                        |
| 87 | - public function getIdentifier($fqcn, array $arguments = array())  | 
                                                        |
| 88 | -    { | 
                                                        |
| 89 | - // only build identifier from arguments if class is not ReservedInstanceInterface  | 
                                                        |
| 90 | - $identifier = ! $this->class_cache->hasInterface(  | 
                                                        |
| 91 | - $fqcn,  | 
                                                        |
| 92 | - 'EventEspresso\core\interfaces\ReservedInstanceInterface'  | 
                                                        |
| 93 | - )  | 
                                                        |
| 94 | - ? $this->getIdentifierForArguments($arguments)  | 
                                                        |
| 95 | - : '';  | 
                                                        |
| 96 | -        if (! empty($identifier)) { | 
                                                        |
| 97 | - $fqcn .= ObjectIdentifier::DELIMITER . md5($identifier);  | 
                                                        |
| 98 | - }  | 
                                                        |
| 99 | - return $fqcn;  | 
                                                        |
| 100 | - }  | 
                                                        |
| 101 | -  | 
                                                        |
| 102 | -  | 
                                                        |
| 103 | - /**  | 
                                                        |
| 104 | - * build a string representation of a object's arguments  | 
                                                        |
| 105 | - * (mostly because Closures can't be serialized)  | 
                                                        |
| 106 | - *  | 
                                                        |
| 107 | - * @param array $arguments  | 
                                                        |
| 108 | - * @return string  | 
                                                        |
| 109 | - */  | 
                                                        |
| 110 | - protected function getIdentifierForArguments(array $arguments)  | 
                                                        |
| 111 | -    { | 
                                                        |
| 112 | -        if (empty($arguments)) { | 
                                                        |
| 113 | - return '';  | 
                                                        |
| 114 | - }  | 
                                                        |
| 115 | - $identifier = '';  | 
                                                        |
| 116 | -        foreach ($arguments as $argument) { | 
                                                        |
| 117 | -            switch (true) { | 
                                                        |
| 118 | - case is_object($argument) :  | 
                                                        |
| 119 | - case $argument instanceof Closure :  | 
                                                        |
| 120 | - $identifier .= spl_object_hash($argument);  | 
                                                        |
| 121 | - break;  | 
                                                        |
| 122 | - case is_array($argument) :  | 
                                                        |
| 123 | - $identifier .= $this->getIdentifierForArguments($argument);  | 
                                                        |
| 124 | - break;  | 
                                                        |
| 125 | - default :  | 
                                                        |
| 126 | - $identifier .= $argument;  | 
                                                        |
| 127 | - break;  | 
                                                        |
| 128 | - }  | 
                                                        |
| 129 | - }  | 
                                                        |
| 130 | - return $identifier;  | 
                                                        |
| 131 | - }  | 
                                                        |
| 23 | + /**  | 
                                                        |
| 24 | + * used to separate the FQCN from the class's arguments identifier  | 
                                                        |
| 25 | + */  | 
                                                        |
| 26 | + const DELIMITER = '____';  | 
                                                        |
| 27 | +  | 
                                                        |
| 28 | + /**  | 
                                                        |
| 29 | + * @var ClassInterfaceCache $class_cache  | 
                                                        |
| 30 | + */  | 
                                                        |
| 31 | + private $class_cache;  | 
                                                        |
| 32 | +  | 
                                                        |
| 33 | +  | 
                                                        |
| 34 | + /**  | 
                                                        |
| 35 | + * ObjectIdentifier constructor.  | 
                                                        |
| 36 | + *  | 
                                                        |
| 37 | + * @param ClassInterfaceCache $class_cache  | 
                                                        |
| 38 | + */  | 
                                                        |
| 39 | + public function __construct(ClassInterfaceCache $class_cache)  | 
                                                        |
| 40 | +	{ | 
                                                        |
| 41 | + $this->class_cache = $class_cache;  | 
                                                        |
| 42 | + }  | 
                                                        |
| 43 | +  | 
                                                        |
| 44 | +  | 
                                                        |
| 45 | + /**  | 
                                                        |
| 46 | + * Returns true if the supplied $object_identifier contains  | 
                                                        |
| 47 | + * the delimiter used to separate an fqcn from the arguments hash  | 
                                                        |
| 48 | + *  | 
                                                        |
| 49 | + * @param string $object_identifier  | 
                                                        |
| 50 | + * @return bool  | 
                                                        |
| 51 | + */  | 
                                                        |
| 52 | + public function hasArguments($object_identifier)  | 
                                                        |
| 53 | +	{ | 
                                                        |
| 54 | + // type casting to bool instead of using strpos() !== false  | 
                                                        |
| 55 | + // because an object identifier should never begin with the delimiter  | 
                                                        |
| 56 | + // therefore the delimiter should NOT be found at position 0  | 
                                                        |
| 57 | + return (bool) strpos($object_identifier, ObjectIdentifier::DELIMITER);  | 
                                                        |
| 58 | + }  | 
                                                        |
| 59 | +  | 
                                                        |
| 60 | +  | 
                                                        |
| 61 | + /**  | 
                                                        |
| 62 | + * Returns true if the supplied FQCN equals the supplied $object_identifier  | 
                                                        |
| 63 | + * OR the supplied FQCN matches the FQCN portion of the supplied $object_identifier  | 
                                                        |
| 64 | + * AND that $object_identifier is for an object with arguments.  | 
                                                        |
| 65 | + * This allows a request for an object using a FQCN to match  | 
                                                        |
| 66 | + * a previously instantiated object with arguments  | 
                                                        |
| 67 | + * without having to know those arguments.  | 
                                                        |
| 68 | + *  | 
                                                        |
| 69 | + * @param string $fqcn  | 
                                                        |
| 70 | + * @param string $object_identifier  | 
                                                        |
| 71 | + * @return bool  | 
                                                        |
| 72 | + */  | 
                                                        |
| 73 | + public function fqcnMatchesObjectIdentifier($fqcn, $object_identifier)  | 
                                                        |
| 74 | +	{ | 
                                                        |
| 75 | + return $fqcn === $object_identifier  | 
                                                        |
| 76 | + || strpos($object_identifier, $fqcn . ObjectIdentifier::DELIMITER) === 0;  | 
                                                        |
| 77 | + }  | 
                                                        |
| 78 | +  | 
                                                        |
| 79 | +  | 
                                                        |
| 80 | + /**  | 
                                                        |
| 81 | + * build a string representation of an object's FQCN and arguments  | 
                                                        |
| 82 | + *  | 
                                                        |
| 83 | + * @param string $fqcn  | 
                                                        |
| 84 | + * @param array $arguments  | 
                                                        |
| 85 | + * @return string  | 
                                                        |
| 86 | + */  | 
                                                        |
| 87 | + public function getIdentifier($fqcn, array $arguments = array())  | 
                                                        |
| 88 | +	{ | 
                                                        |
| 89 | + // only build identifier from arguments if class is not ReservedInstanceInterface  | 
                                                        |
| 90 | + $identifier = ! $this->class_cache->hasInterface(  | 
                                                        |
| 91 | + $fqcn,  | 
                                                        |
| 92 | + 'EventEspresso\core\interfaces\ReservedInstanceInterface'  | 
                                                        |
| 93 | + )  | 
                                                        |
| 94 | + ? $this->getIdentifierForArguments($arguments)  | 
                                                        |
| 95 | + : '';  | 
                                                        |
| 96 | +		if (! empty($identifier)) { | 
                                                        |
| 97 | + $fqcn .= ObjectIdentifier::DELIMITER . md5($identifier);  | 
                                                        |
| 98 | + }  | 
                                                        |
| 99 | + return $fqcn;  | 
                                                        |
| 100 | + }  | 
                                                        |
| 101 | +  | 
                                                        |
| 102 | +  | 
                                                        |
| 103 | + /**  | 
                                                        |
| 104 | + * build a string representation of a object's arguments  | 
                                                        |
| 105 | + * (mostly because Closures can't be serialized)  | 
                                                        |
| 106 | + *  | 
                                                        |
| 107 | + * @param array $arguments  | 
                                                        |
| 108 | + * @return string  | 
                                                        |
| 109 | + */  | 
                                                        |
| 110 | + protected function getIdentifierForArguments(array $arguments)  | 
                                                        |
| 111 | +	{ | 
                                                        |
| 112 | +		if (empty($arguments)) { | 
                                                        |
| 113 | + return '';  | 
                                                        |
| 114 | + }  | 
                                                        |
| 115 | + $identifier = '';  | 
                                                        |
| 116 | +		foreach ($arguments as $argument) { | 
                                                        |
| 117 | +			switch (true) { | 
                                                        |
| 118 | + case is_object($argument) :  | 
                                                        |
| 119 | + case $argument instanceof Closure :  | 
                                                        |
| 120 | + $identifier .= spl_object_hash($argument);  | 
                                                        |
| 121 | + break;  | 
                                                        |
| 122 | + case is_array($argument) :  | 
                                                        |
| 123 | + $identifier .= $this->getIdentifierForArguments($argument);  | 
                                                        |
| 124 | + break;  | 
                                                        |
| 125 | + default :  | 
                                                        |
| 126 | + $identifier .= $argument;  | 
                                                        |
| 127 | + break;  | 
                                                        |
| 128 | + }  | 
                                                        |
| 129 | + }  | 
                                                        |
| 130 | + return $identifier;  | 
                                                        |
| 131 | + }  | 
                                                        |
| 132 | 132 | }  | 
                                                        
| 133 | 133 | \ No newline at end of file  | 
                                                        
@@ -73,7 +73,7 @@ discard block  | 
                                                    ||
| 73 | 73 | public function fqcnMatchesObjectIdentifier($fqcn, $object_identifier)  | 
                                                        
| 74 | 74 |      { | 
                                                        
| 75 | 75 | return $fqcn === $object_identifier  | 
                                                        
| 76 | - || strpos($object_identifier, $fqcn . ObjectIdentifier::DELIMITER) === 0;  | 
                                                        |
| 76 | + || strpos($object_identifier, $fqcn.ObjectIdentifier::DELIMITER) === 0;  | 
                                                        |
| 77 | 77 | }  | 
                                                        
| 78 | 78 | |
| 79 | 79 | |
@@ -93,8 +93,8 @@ discard block  | 
                                                    ||
| 93 | 93 | )  | 
                                                        
| 94 | 94 | ? $this->getIdentifierForArguments($arguments)  | 
                                                        
| 95 | 95 | : '';  | 
                                                        
| 96 | -        if (! empty($identifier)) { | 
                                                        |
| 97 | - $fqcn .= ObjectIdentifier::DELIMITER . md5($identifier);  | 
                                                        |
| 96 | +        if ( ! empty($identifier)) { | 
                                                        |
| 97 | + $fqcn .= ObjectIdentifier::DELIMITER.md5($identifier);  | 
                                                        |
| 98 | 98 | }  | 
                                                        
| 99 | 99 | return $fqcn;  | 
                                                        
| 100 | 100 | }  | 
                                                        
@@ -27,1668 +27,1668 @@  | 
                                                    ||
| 27 | 27 | class EE_Registry implements ResettableInterface  | 
                                                        
| 28 | 28 |  { | 
                                                        
| 29 | 29 | |
| 30 | - /**  | 
                                                        |
| 31 | - * @var EE_Registry $_instance  | 
                                                        |
| 32 | - */  | 
                                                        |
| 33 | - private static $_instance;  | 
                                                        |
| 34 | -  | 
                                                        |
| 35 | - /**  | 
                                                        |
| 36 | - * @var EE_Dependency_Map $_dependency_map  | 
                                                        |
| 37 | - */  | 
                                                        |
| 38 | - protected $_dependency_map;  | 
                                                        |
| 39 | -  | 
                                                        |
| 40 | - /**  | 
                                                        |
| 41 | - * @var Mirror  | 
                                                        |
| 42 | - */  | 
                                                        |
| 43 | - private $mirror;  | 
                                                        |
| 44 | -  | 
                                                        |
| 45 | - /**  | 
                                                        |
| 46 | - * @var ClassInterfaceCache $class_cache  | 
                                                        |
| 47 | - */  | 
                                                        |
| 48 | - private $class_cache;  | 
                                                        |
| 49 | -  | 
                                                        |
| 50 | - /**  | 
                                                        |
| 51 | - * @var array $_class_abbreviations  | 
                                                        |
| 52 | - */  | 
                                                        |
| 53 | - protected $_class_abbreviations = array();  | 
                                                        |
| 54 | -  | 
                                                        |
| 55 | - /**  | 
                                                        |
| 56 | - * @var CommandBusInterface $BUS  | 
                                                        |
| 57 | - */  | 
                                                        |
| 58 | - public $BUS;  | 
                                                        |
| 59 | -  | 
                                                        |
| 60 | - /**  | 
                                                        |
| 61 | - * @var EE_Cart $CART  | 
                                                        |
| 62 | - */  | 
                                                        |
| 63 | - public $CART;  | 
                                                        |
| 64 | -  | 
                                                        |
| 65 | - /**  | 
                                                        |
| 66 | - * @var EE_Config $CFG  | 
                                                        |
| 67 | - */  | 
                                                        |
| 68 | - public $CFG;  | 
                                                        |
| 69 | -  | 
                                                        |
| 70 | - /**  | 
                                                        |
| 71 | - * @var EE_Network_Config $NET_CFG  | 
                                                        |
| 72 | - */  | 
                                                        |
| 73 | - public $NET_CFG;  | 
                                                        |
| 74 | -  | 
                                                        |
| 75 | - /**  | 
                                                        |
| 76 | - * StdClass object for storing library classes in  | 
                                                        |
| 77 | - *  | 
                                                        |
| 78 | - * @var RegistryContainer $LIB  | 
                                                        |
| 79 | - */  | 
                                                        |
| 80 | - public $LIB;  | 
                                                        |
| 81 | -  | 
                                                        |
| 82 | - /**  | 
                                                        |
| 83 | - * @var EE_Request_Handler $REQ  | 
                                                        |
| 84 | - */  | 
                                                        |
| 85 | - public $REQ;  | 
                                                        |
| 86 | -  | 
                                                        |
| 87 | - /**  | 
                                                        |
| 88 | - * @var EE_Session $SSN  | 
                                                        |
| 89 | - */  | 
                                                        |
| 90 | - public $SSN;  | 
                                                        |
| 91 | -  | 
                                                        |
| 92 | - /**  | 
                                                        |
| 93 | - * @since 4.5.0  | 
                                                        |
| 94 | - * @var EE_Capabilities $CAP  | 
                                                        |
| 95 | - */  | 
                                                        |
| 96 | - public $CAP;  | 
                                                        |
| 97 | -  | 
                                                        |
| 98 | - /**  | 
                                                        |
| 99 | - * @since 4.9.0  | 
                                                        |
| 100 | - * @var EE_Message_Resource_Manager $MRM  | 
                                                        |
| 101 | - */  | 
                                                        |
| 102 | - public $MRM;  | 
                                                        |
| 103 | -  | 
                                                        |
| 104 | - /**  | 
                                                        |
| 105 | - * @var Registry $AssetsRegistry  | 
                                                        |
| 106 | - */  | 
                                                        |
| 107 | - public $AssetsRegistry;  | 
                                                        |
| 108 | -  | 
                                                        |
| 109 | - /**  | 
                                                        |
| 110 | - * StdClass object for holding addons which have registered themselves to work with EE core  | 
                                                        |
| 111 | - *  | 
                                                        |
| 112 | - * @var EE_Addon[] $addons  | 
                                                        |
| 113 | - */  | 
                                                        |
| 114 | - public $addons;  | 
                                                        |
| 115 | -  | 
                                                        |
| 116 | - /**  | 
                                                        |
| 117 | - * keys are 'short names' (eg Event), values are class names (eg 'EEM_Event')  | 
                                                        |
| 118 | - *  | 
                                                        |
| 119 | - * @var EEM_Base[] $models  | 
                                                        |
| 120 | - */  | 
                                                        |
| 121 | - public $models = array();  | 
                                                        |
| 122 | -  | 
                                                        |
| 123 | - /**  | 
                                                        |
| 124 | - * @var EED_Module[] $modules  | 
                                                        |
| 125 | - */  | 
                                                        |
| 126 | - public $modules;  | 
                                                        |
| 127 | -  | 
                                                        |
| 128 | - /**  | 
                                                        |
| 129 | - * @var EES_Shortcode[] $shortcodes  | 
                                                        |
| 130 | - */  | 
                                                        |
| 131 | - public $shortcodes;  | 
                                                        |
| 132 | -  | 
                                                        |
| 133 | - /**  | 
                                                        |
| 134 | - * @var WP_Widget[] $widgets  | 
                                                        |
| 135 | - */  | 
                                                        |
| 136 | - public $widgets;  | 
                                                        |
| 137 | -  | 
                                                        |
| 138 | - /**  | 
                                                        |
| 139 | - * this is an array of all implemented model names (i.e. not the parent abstract models, or models  | 
                                                        |
| 140 | - * which don't actually fetch items from the DB in the normal way (ie, are not children of EEM_Base)).  | 
                                                        |
| 141 | - * Keys are model "short names" (eg "Event") as used in model relations, and values are  | 
                                                        |
| 142 | - * classnames (eg "EEM_Event")  | 
                                                        |
| 143 | - *  | 
                                                        |
| 144 | - * @var array $non_abstract_db_models  | 
                                                        |
| 145 | - */  | 
                                                        |
| 146 | - public $non_abstract_db_models = array();  | 
                                                        |
| 147 | -  | 
                                                        |
| 148 | - /**  | 
                                                        |
| 149 | - * internationalization for JS strings  | 
                                                        |
| 150 | - * usage: EE_Registry::i18n_js_strings['string_key'] = esc_html__( 'string to translate.', 'event_espresso' );  | 
                                                        |
| 151 | - * in js file: var translatedString = eei18n.string_key;  | 
                                                        |
| 152 | - *  | 
                                                        |
| 153 | - * @var array $i18n_js_strings  | 
                                                        |
| 154 | - */  | 
                                                        |
| 155 | - public static $i18n_js_strings = array();  | 
                                                        |
| 156 | -  | 
                                                        |
| 157 | - /**  | 
                                                        |
| 158 | - * $main_file - path to espresso.php  | 
                                                        |
| 159 | - *  | 
                                                        |
| 160 | - * @var array $main_file  | 
                                                        |
| 161 | - */  | 
                                                        |
| 162 | - public $main_file;  | 
                                                        |
| 163 | -  | 
                                                        |
| 164 | - /**  | 
                                                        |
| 165 | - * array of ReflectionClass objects where the key is the class name  | 
                                                        |
| 166 | - *  | 
                                                        |
| 167 | - * @deprecated $VID:$  | 
                                                        |
| 168 | - * @var ReflectionClass[] $_reflectors  | 
                                                        |
| 169 | - */  | 
                                                        |
| 170 | - public $_reflectors;  | 
                                                        |
| 171 | -  | 
                                                        |
| 172 | - /**  | 
                                                        |
| 173 | - * boolean flag to indicate whether or not to load/save dependencies from/to the cache  | 
                                                        |
| 174 | - *  | 
                                                        |
| 175 | - * @var boolean $_cache_on  | 
                                                        |
| 176 | - */  | 
                                                        |
| 177 | - protected $_cache_on = true;  | 
                                                        |
| 178 | -  | 
                                                        |
| 179 | - /**  | 
                                                        |
| 180 | - * @var ObjectIdentifier  | 
                                                        |
| 181 | - */  | 
                                                        |
| 182 | - private $object_identifier;  | 
                                                        |
| 183 | -  | 
                                                        |
| 184 | -  | 
                                                        |
| 185 | - /**  | 
                                                        |
| 186 | - * @singleton method used to instantiate class object  | 
                                                        |
| 187 | - * @param EE_Dependency_Map|null $dependency_map  | 
                                                        |
| 188 | - * @param Mirror|null $mirror  | 
                                                        |
| 189 | - * @param ClassInterfaceCache|null $class_cache  | 
                                                        |
| 190 | - * @param ObjectIdentifier|null $object_identifier  | 
                                                        |
| 191 | - * @return EE_Registry instance  | 
                                                        |
| 192 | - */  | 
                                                        |
| 193 | - public static function instance(  | 
                                                        |
| 194 | - EE_Dependency_Map $dependency_map = null,  | 
                                                        |
| 195 | - Mirror $mirror = null,  | 
                                                        |
| 196 | - ClassInterfaceCache $class_cache = null,  | 
                                                        |
| 197 | - ObjectIdentifier $object_identifier = null  | 
                                                        |
| 198 | -    ) { | 
                                                        |
| 199 | - // check if class object is instantiated  | 
                                                        |
| 200 | - if (  | 
                                                        |
| 201 | - ! self::$_instance instanceof EE_Registry  | 
                                                        |
| 202 | - && $dependency_map instanceof EE_Dependency_Map  | 
                                                        |
| 203 | - && $mirror instanceof Mirror  | 
                                                        |
| 204 | - && $class_cache instanceof ClassInterfaceCache  | 
                                                        |
| 205 | - && $object_identifier instanceof ObjectIdentifier  | 
                                                        |
| 206 | -        ) { | 
                                                        |
| 207 | - self::$_instance = new self(  | 
                                                        |
| 208 | - $dependency_map,  | 
                                                        |
| 209 | - $mirror,  | 
                                                        |
| 210 | - $class_cache,  | 
                                                        |
| 211 | - $object_identifier  | 
                                                        |
| 212 | - );  | 
                                                        |
| 213 | - }  | 
                                                        |
| 214 | - return self::$_instance;  | 
                                                        |
| 215 | - }  | 
                                                        |
| 216 | -  | 
                                                        |
| 217 | -  | 
                                                        |
| 218 | - /**  | 
                                                        |
| 219 | - * protected constructor to prevent direct creation  | 
                                                        |
| 220 | - *  | 
                                                        |
| 221 | - * @Constructor  | 
                                                        |
| 222 | - * @param EE_Dependency_Map $dependency_map  | 
                                                        |
| 223 | - * @param Mirror $mirror  | 
                                                        |
| 224 | - * @param ClassInterfaceCache $class_cache  | 
                                                        |
| 225 | - * @param ObjectIdentifier $object_identifier  | 
                                                        |
| 226 | - */  | 
                                                        |
| 227 | - protected function __construct(  | 
                                                        |
| 228 | - EE_Dependency_Map $dependency_map,  | 
                                                        |
| 229 | - Mirror $mirror,  | 
                                                        |
| 230 | - ClassInterfaceCache $class_cache,  | 
                                                        |
| 231 | - ObjectIdentifier $object_identifier  | 
                                                        |
| 232 | -    ) { | 
                                                        |
| 233 | - $this->_dependency_map = $dependency_map;  | 
                                                        |
| 234 | - $this->mirror = $mirror;  | 
                                                        |
| 235 | - $this->class_cache = $class_cache;  | 
                                                        |
| 236 | - $this->object_identifier = $object_identifier;  | 
                                                        |
| 237 | - // $registry_container = new RegistryContainer();  | 
                                                        |
| 238 | - $this->LIB = new RegistryContainer();  | 
                                                        |
| 239 | - $this->addons = new RegistryContainer();  | 
                                                        |
| 240 | - $this->modules = new RegistryContainer();  | 
                                                        |
| 241 | - $this->shortcodes = new RegistryContainer();  | 
                                                        |
| 242 | - $this->widgets = new RegistryContainer();  | 
                                                        |
| 243 | -        add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize')); | 
                                                        |
| 244 | - }  | 
                                                        |
| 245 | -  | 
                                                        |
| 246 | -  | 
                                                        |
| 247 | - /**  | 
                                                        |
| 248 | - * initialize  | 
                                                        |
| 249 | - *  | 
                                                        |
| 250 | - * @throws OutOfBoundsException  | 
                                                        |
| 251 | - * @throws InvalidArgumentException  | 
                                                        |
| 252 | - * @throws InvalidInterfaceException  | 
                                                        |
| 253 | - * @throws InvalidDataTypeException  | 
                                                        |
| 254 | - * @throws EE_Error  | 
                                                        |
| 255 | - * @throws ReflectionException  | 
                                                        |
| 256 | - */  | 
                                                        |
| 257 | - public function initialize()  | 
                                                        |
| 258 | -    { | 
                                                        |
| 259 | - $this->_class_abbreviations = apply_filters(  | 
                                                        |
| 260 | - 'FHEE__EE_Registry____construct___class_abbreviations',  | 
                                                        |
| 261 | - array(  | 
                                                        |
| 262 | - 'EE_Config' => 'CFG',  | 
                                                        |
| 263 | - 'EE_Session' => 'SSN',  | 
                                                        |
| 264 | - 'EE_Capabilities' => 'CAP',  | 
                                                        |
| 265 | - 'EE_Cart' => 'CART',  | 
                                                        |
| 266 | - 'EE_Network_Config' => 'NET_CFG',  | 
                                                        |
| 267 | - 'EE_Request_Handler' => 'REQ',  | 
                                                        |
| 268 | - 'EE_Message_Resource_Manager' => 'MRM',  | 
                                                        |
| 269 | - 'EventEspresso\core\services\commands\CommandBus' => 'BUS',  | 
                                                        |
| 270 | - 'EventEspresso\core\services\assets\Registry' => 'AssetsRegistry',  | 
                                                        |
| 271 | - )  | 
                                                        |
| 272 | - );  | 
                                                        |
| 273 | -        $this->load_core('Base', array(), true); | 
                                                        |
| 274 | - // add our request and response objects to the cache  | 
                                                        |
| 275 | - $request_loader = $this->_dependency_map->class_loader(  | 
                                                        |
| 276 | - 'EventEspresso\core\services\request\Request'  | 
                                                        |
| 277 | - );  | 
                                                        |
| 278 | - $this->_set_cached_class(  | 
                                                        |
| 279 | - $request_loader(),  | 
                                                        |
| 280 | - 'EventEspresso\core\services\request\Request'  | 
                                                        |
| 281 | - );  | 
                                                        |
| 282 | - $response_loader = $this->_dependency_map->class_loader(  | 
                                                        |
| 283 | - 'EventEspresso\core\services\request\Response'  | 
                                                        |
| 284 | - );  | 
                                                        |
| 285 | - $this->_set_cached_class(  | 
                                                        |
| 286 | - $response_loader(),  | 
                                                        |
| 287 | - 'EventEspresso\core\services\request\Response'  | 
                                                        |
| 288 | - );  | 
                                                        |
| 289 | -        add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init')); | 
                                                        |
| 290 | - }  | 
                                                        |
| 291 | -  | 
                                                        |
| 292 | -  | 
                                                        |
| 293 | - /**  | 
                                                        |
| 294 | - * @return void  | 
                                                        |
| 295 | - */  | 
                                                        |
| 296 | - public function init()  | 
                                                        |
| 297 | -    { | 
                                                        |
| 298 | - // Get current page protocol  | 
                                                        |
| 299 | - $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';  | 
                                                        |
| 300 | - // Output admin-ajax.php URL with same protocol as current page  | 
                                                        |
| 301 | -        self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol); | 
                                                        |
| 302 | -        self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : false; | 
                                                        |
| 303 | - }  | 
                                                        |
| 304 | -  | 
                                                        |
| 305 | -  | 
                                                        |
| 306 | - /**  | 
                                                        |
| 307 | - * localize_i18n_js_strings  | 
                                                        |
| 308 | - *  | 
                                                        |
| 309 | - * @return string  | 
                                                        |
| 310 | - */  | 
                                                        |
| 311 | - public static function localize_i18n_js_strings()  | 
                                                        |
| 312 | -    { | 
                                                        |
| 313 | - $i18n_js_strings = (array) self::$i18n_js_strings;  | 
                                                        |
| 314 | -        foreach ($i18n_js_strings as $key => $value) { | 
                                                        |
| 315 | -            if (is_scalar($value)) { | 
                                                        |
| 316 | - $i18n_js_strings[ $key ] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');  | 
                                                        |
| 317 | - }  | 
                                                        |
| 318 | - }  | 
                                                        |
| 319 | - return '/* <![CDATA[ */ var eei18n = ' . wp_json_encode($i18n_js_strings) . '; /* ]]> */';  | 
                                                        |
| 320 | - }  | 
                                                        |
| 321 | -  | 
                                                        |
| 322 | -  | 
                                                        |
| 323 | - /**  | 
                                                        |
| 324 | - * @param mixed string | EED_Module $module  | 
                                                        |
| 325 | - * @throws OutOfBoundsException  | 
                                                        |
| 326 | - * @throws InvalidArgumentException  | 
                                                        |
| 327 | - * @throws InvalidInterfaceException  | 
                                                        |
| 328 | - * @throws InvalidDataTypeException  | 
                                                        |
| 329 | - * @throws EE_Error  | 
                                                        |
| 330 | - * @throws ReflectionException  | 
                                                        |
| 331 | - */  | 
                                                        |
| 332 | - public function add_module($module)  | 
                                                        |
| 333 | -    { | 
                                                        |
| 334 | -        if ($module instanceof EED_Module) { | 
                                                        |
| 335 | - $module_class = get_class($module);  | 
                                                        |
| 336 | -            $this->modules->{$module_class} = $module; | 
                                                        |
| 337 | -        } else { | 
                                                        |
| 338 | -            if (! class_exists('EE_Module_Request_Router', false)) { | 
                                                        |
| 339 | -                $this->load_core('Module_Request_Router'); | 
                                                        |
| 340 | - }  | 
                                                        |
| 341 | - EE_Module_Request_Router::module_factory($module);  | 
                                                        |
| 342 | - }  | 
                                                        |
| 343 | - }  | 
                                                        |
| 344 | -  | 
                                                        |
| 345 | -  | 
                                                        |
| 346 | - /**  | 
                                                        |
| 347 | - * @param string $module_name  | 
                                                        |
| 348 | - * @return mixed EED_Module | NULL  | 
                                                        |
| 349 | - */  | 
                                                        |
| 350 | - public function get_module($module_name = '')  | 
                                                        |
| 351 | -    { | 
                                                        |
| 352 | -        return isset($this->modules->{$module_name}) | 
                                                        |
| 353 | -            ? $this->modules->{$module_name} | 
                                                        |
| 354 | - : null;  | 
                                                        |
| 355 | - }  | 
                                                        |
| 356 | -  | 
                                                        |
| 357 | -  | 
                                                        |
| 358 | - /**  | 
                                                        |
| 359 | - * loads core classes - must be singletons  | 
                                                        |
| 360 | - *  | 
                                                        |
| 361 | - * @param string $class_name - simple class name ie: session  | 
                                                        |
| 362 | - * @param mixed $arguments  | 
                                                        |
| 363 | - * @param bool $load_only  | 
                                                        |
| 364 | - * @return mixed  | 
                                                        |
| 365 | - * @throws InvalidInterfaceException  | 
                                                        |
| 366 | - * @throws InvalidDataTypeException  | 
                                                        |
| 367 | - * @throws EE_Error  | 
                                                        |
| 368 | - * @throws ReflectionException  | 
                                                        |
| 369 | - * @throws InvalidArgumentException  | 
                                                        |
| 370 | - */  | 
                                                        |
| 371 | - public function load_core($class_name, $arguments = array(), $load_only = false)  | 
                                                        |
| 372 | -    { | 
                                                        |
| 373 | - $core_paths = apply_filters(  | 
                                                        |
| 374 | - 'FHEE__EE_Registry__load_core__core_paths',  | 
                                                        |
| 375 | - array(  | 
                                                        |
| 376 | - EE_CORE,  | 
                                                        |
| 377 | - EE_ADMIN,  | 
                                                        |
| 378 | - EE_CPTS,  | 
                                                        |
| 379 | - EE_CORE . 'data_migration_scripts' . DS,  | 
                                                        |
| 380 | - EE_CORE . 'capabilities' . DS,  | 
                                                        |
| 381 | - EE_CORE . 'request_stack' . DS,  | 
                                                        |
| 382 | - EE_CORE . 'middleware' . DS,  | 
                                                        |
| 383 | - )  | 
                                                        |
| 384 | - );  | 
                                                        |
| 385 | - // retrieve instantiated class  | 
                                                        |
| 386 | - return $this->_load(  | 
                                                        |
| 387 | - $core_paths,  | 
                                                        |
| 388 | - 'EE_',  | 
                                                        |
| 389 | - $class_name,  | 
                                                        |
| 390 | - 'core',  | 
                                                        |
| 391 | - $arguments,  | 
                                                        |
| 392 | - false,  | 
                                                        |
| 393 | - true,  | 
                                                        |
| 394 | - $load_only  | 
                                                        |
| 395 | - );  | 
                                                        |
| 396 | - }  | 
                                                        |
| 397 | -  | 
                                                        |
| 398 | -  | 
                                                        |
| 399 | - /**  | 
                                                        |
| 400 | - * loads service classes  | 
                                                        |
| 401 | - *  | 
                                                        |
| 402 | - * @param string $class_name - simple class name ie: session  | 
                                                        |
| 403 | - * @param mixed $arguments  | 
                                                        |
| 404 | - * @param bool $load_only  | 
                                                        |
| 405 | - * @return mixed  | 
                                                        |
| 406 | - * @throws InvalidInterfaceException  | 
                                                        |
| 407 | - * @throws InvalidDataTypeException  | 
                                                        |
| 408 | - * @throws EE_Error  | 
                                                        |
| 409 | - * @throws ReflectionException  | 
                                                        |
| 410 | - * @throws InvalidArgumentException  | 
                                                        |
| 411 | - */  | 
                                                        |
| 412 | - public function load_service($class_name, $arguments = array(), $load_only = false)  | 
                                                        |
| 413 | -    { | 
                                                        |
| 414 | - $service_paths = apply_filters(  | 
                                                        |
| 415 | - 'FHEE__EE_Registry__load_service__service_paths',  | 
                                                        |
| 416 | - array(  | 
                                                        |
| 417 | - EE_CORE . 'services' . DS,  | 
                                                        |
| 418 | - )  | 
                                                        |
| 419 | - );  | 
                                                        |
| 420 | - // retrieve instantiated class  | 
                                                        |
| 421 | - return $this->_load(  | 
                                                        |
| 422 | - $service_paths,  | 
                                                        |
| 423 | - 'EE_',  | 
                                                        |
| 424 | - $class_name,  | 
                                                        |
| 425 | - 'class',  | 
                                                        |
| 426 | - $arguments,  | 
                                                        |
| 427 | - false,  | 
                                                        |
| 428 | - true,  | 
                                                        |
| 429 | - $load_only  | 
                                                        |
| 430 | - );  | 
                                                        |
| 431 | - }  | 
                                                        |
| 432 | -  | 
                                                        |
| 433 | -  | 
                                                        |
| 434 | - /**  | 
                                                        |
| 435 | - * loads data_migration_scripts  | 
                                                        |
| 436 | - *  | 
                                                        |
| 437 | - * @param string $class_name - class name for the DMS ie: EE_DMS_Core_4_2_0  | 
                                                        |
| 438 | - * @param mixed $arguments  | 
                                                        |
| 439 | - * @return EE_Data_Migration_Script_Base|mixed  | 
                                                        |
| 440 | - * @throws InvalidInterfaceException  | 
                                                        |
| 441 | - * @throws InvalidDataTypeException  | 
                                                        |
| 442 | - * @throws EE_Error  | 
                                                        |
| 443 | - * @throws ReflectionException  | 
                                                        |
| 444 | - * @throws InvalidArgumentException  | 
                                                        |
| 445 | - */  | 
                                                        |
| 446 | - public function load_dms($class_name, $arguments = array())  | 
                                                        |
| 447 | -    { | 
                                                        |
| 448 | - // retrieve instantiated class  | 
                                                        |
| 449 | - return $this->_load(  | 
                                                        |
| 450 | - EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(),  | 
                                                        |
| 451 | - 'EE_DMS_',  | 
                                                        |
| 452 | - $class_name,  | 
                                                        |
| 453 | - 'dms',  | 
                                                        |
| 454 | - $arguments,  | 
                                                        |
| 455 | - false,  | 
                                                        |
| 456 | - false  | 
                                                        |
| 457 | - );  | 
                                                        |
| 458 | - }  | 
                                                        |
| 459 | -  | 
                                                        |
| 460 | -  | 
                                                        |
| 461 | - /**  | 
                                                        |
| 462 | - * loads object creating classes - must be singletons  | 
                                                        |
| 463 | - *  | 
                                                        |
| 464 | - * @param string $class_name - simple class name ie: attendee  | 
                                                        |
| 465 | - * @param mixed $arguments - an array of arguments to pass to the class  | 
                                                        |
| 466 | - * @param bool $from_db - some classes are instantiated from the db and thus call a different method to  | 
                                                        |
| 467 | - * instantiate  | 
                                                        |
| 468 | - * @param bool $cache if you don't want the class to be stored in the internal cache (non-persistent) then  | 
                                                        |
| 469 | - * set this to FALSE (ie. when instantiating model objects from client in a loop)  | 
                                                        |
| 470 | - * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate  | 
                                                        |
| 471 | - * (default)  | 
                                                        |
| 472 | - * @return EE_Base_Class | bool  | 
                                                        |
| 473 | - * @throws InvalidInterfaceException  | 
                                                        |
| 474 | - * @throws InvalidDataTypeException  | 
                                                        |
| 475 | - * @throws EE_Error  | 
                                                        |
| 476 | - * @throws ReflectionException  | 
                                                        |
| 477 | - * @throws InvalidArgumentException  | 
                                                        |
| 478 | - */  | 
                                                        |
| 479 | - public function load_class($class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false)  | 
                                                        |
| 480 | -    { | 
                                                        |
| 481 | - $paths = apply_filters(  | 
                                                        |
| 482 | - 'FHEE__EE_Registry__load_class__paths', array(  | 
                                                        |
| 483 | - EE_CORE,  | 
                                                        |
| 484 | - EE_CLASSES,  | 
                                                        |
| 485 | - EE_BUSINESS,  | 
                                                        |
| 486 | - )  | 
                                                        |
| 487 | - );  | 
                                                        |
| 488 | - // retrieve instantiated class  | 
                                                        |
| 489 | - return $this->_load(  | 
                                                        |
| 490 | - $paths,  | 
                                                        |
| 491 | - 'EE_',  | 
                                                        |
| 492 | - $class_name,  | 
                                                        |
| 493 | - 'class',  | 
                                                        |
| 494 | - $arguments,  | 
                                                        |
| 495 | - $from_db,  | 
                                                        |
| 496 | - $cache,  | 
                                                        |
| 497 | - $load_only  | 
                                                        |
| 498 | - );  | 
                                                        |
| 499 | - }  | 
                                                        |
| 500 | -  | 
                                                        |
| 501 | -  | 
                                                        |
| 502 | - /**  | 
                                                        |
| 503 | - * loads helper classes - must be singletons  | 
                                                        |
| 504 | - *  | 
                                                        |
| 505 | - * @param string $class_name - simple class name ie: price  | 
                                                        |
| 506 | - * @param mixed $arguments  | 
                                                        |
| 507 | - * @param bool $load_only  | 
                                                        |
| 508 | - * @return EEH_Base | bool  | 
                                                        |
| 509 | - * @throws InvalidInterfaceException  | 
                                                        |
| 510 | - * @throws InvalidDataTypeException  | 
                                                        |
| 511 | - * @throws EE_Error  | 
                                                        |
| 512 | - * @throws ReflectionException  | 
                                                        |
| 513 | - * @throws InvalidArgumentException  | 
                                                        |
| 514 | - */  | 
                                                        |
| 515 | - public function load_helper($class_name, $arguments = array(), $load_only = true)  | 
                                                        |
| 516 | -    { | 
                                                        |
| 517 | - // todo: add doing_it_wrong() in a few versions after all addons have had calls to this method removed  | 
                                                        |
| 518 | -        $helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS)); | 
                                                        |
| 519 | - // retrieve instantiated class  | 
                                                        |
| 520 | - return $this->_load(  | 
                                                        |
| 521 | - $helper_paths,  | 
                                                        |
| 522 | - 'EEH_',  | 
                                                        |
| 523 | - $class_name,  | 
                                                        |
| 524 | - 'helper',  | 
                                                        |
| 525 | - $arguments,  | 
                                                        |
| 526 | - false,  | 
                                                        |
| 527 | - true,  | 
                                                        |
| 528 | - $load_only  | 
                                                        |
| 529 | - );  | 
                                                        |
| 530 | - }  | 
                                                        |
| 531 | -  | 
                                                        |
| 532 | -  | 
                                                        |
| 533 | - /**  | 
                                                        |
| 534 | - * loads core classes - must be singletons  | 
                                                        |
| 535 | - *  | 
                                                        |
| 536 | - * @param string $class_name - simple class name ie: session  | 
                                                        |
| 537 | - * @param mixed $arguments  | 
                                                        |
| 538 | - * @param bool $load_only  | 
                                                        |
| 539 | - * @param bool $cache whether to cache the object or not.  | 
                                                        |
| 540 | - * @return mixed  | 
                                                        |
| 541 | - * @throws InvalidInterfaceException  | 
                                                        |
| 542 | - * @throws InvalidDataTypeException  | 
                                                        |
| 543 | - * @throws EE_Error  | 
                                                        |
| 544 | - * @throws ReflectionException  | 
                                                        |
| 545 | - * @throws InvalidArgumentException  | 
                                                        |
| 546 | - */  | 
                                                        |
| 547 | - public function load_lib($class_name, $arguments = array(), $load_only = false, $cache = true)  | 
                                                        |
| 548 | -    { | 
                                                        |
| 549 | - $paths = array(  | 
                                                        |
| 550 | - EE_LIBRARIES,  | 
                                                        |
| 551 | - EE_LIBRARIES . 'messages' . DS,  | 
                                                        |
| 552 | - EE_LIBRARIES . 'shortcodes' . DS,  | 
                                                        |
| 553 | - EE_LIBRARIES . 'qtips' . DS,  | 
                                                        |
| 554 | - EE_LIBRARIES . 'payment_methods' . DS,  | 
                                                        |
| 555 | - );  | 
                                                        |
| 556 | - // retrieve instantiated class  | 
                                                        |
| 557 | - return $this->_load(  | 
                                                        |
| 558 | - $paths,  | 
                                                        |
| 559 | - 'EE_',  | 
                                                        |
| 560 | - $class_name,  | 
                                                        |
| 561 | - 'lib',  | 
                                                        |
| 562 | - $arguments,  | 
                                                        |
| 563 | - false,  | 
                                                        |
| 564 | - $cache,  | 
                                                        |
| 565 | - $load_only  | 
                                                        |
| 566 | - );  | 
                                                        |
| 567 | - }  | 
                                                        |
| 568 | -  | 
                                                        |
| 569 | -  | 
                                                        |
| 570 | - /**  | 
                                                        |
| 571 | - * loads model classes - must be singletons  | 
                                                        |
| 572 | - *  | 
                                                        |
| 573 | - * @param string $class_name - simple class name ie: price  | 
                                                        |
| 574 | - * @param mixed $arguments  | 
                                                        |
| 575 | - * @param bool $load_only  | 
                                                        |
| 576 | - * @return EEM_Base | bool  | 
                                                        |
| 577 | - * @throws InvalidInterfaceException  | 
                                                        |
| 578 | - * @throws InvalidDataTypeException  | 
                                                        |
| 579 | - * @throws EE_Error  | 
                                                        |
| 580 | - * @throws ReflectionException  | 
                                                        |
| 581 | - * @throws InvalidArgumentException  | 
                                                        |
| 582 | - */  | 
                                                        |
| 583 | - public function load_model($class_name, $arguments = array(), $load_only = false)  | 
                                                        |
| 584 | -    { | 
                                                        |
| 585 | - $paths = apply_filters(  | 
                                                        |
| 586 | - 'FHEE__EE_Registry__load_model__paths', array(  | 
                                                        |
| 587 | - EE_MODELS,  | 
                                                        |
| 588 | - EE_CORE,  | 
                                                        |
| 589 | - )  | 
                                                        |
| 590 | - );  | 
                                                        |
| 591 | - // retrieve instantiated class  | 
                                                        |
| 592 | - return $this->_load(  | 
                                                        |
| 593 | - $paths,  | 
                                                        |
| 594 | - 'EEM_',  | 
                                                        |
| 595 | - $class_name,  | 
                                                        |
| 596 | - 'model',  | 
                                                        |
| 597 | - $arguments,  | 
                                                        |
| 598 | - false,  | 
                                                        |
| 599 | - true,  | 
                                                        |
| 600 | - $load_only  | 
                                                        |
| 601 | - );  | 
                                                        |
| 602 | - }  | 
                                                        |
| 603 | -  | 
                                                        |
| 604 | -  | 
                                                        |
| 605 | - /**  | 
                                                        |
| 606 | - * loads model classes - must be singletons  | 
                                                        |
| 607 | - *  | 
                                                        |
| 608 | - * @param string $class_name - simple class name ie: price  | 
                                                        |
| 609 | - * @param mixed $arguments  | 
                                                        |
| 610 | - * @param bool $load_only  | 
                                                        |
| 611 | - * @return mixed | bool  | 
                                                        |
| 612 | - * @throws InvalidInterfaceException  | 
                                                        |
| 613 | - * @throws InvalidDataTypeException  | 
                                                        |
| 614 | - * @throws EE_Error  | 
                                                        |
| 615 | - * @throws ReflectionException  | 
                                                        |
| 616 | - * @throws InvalidArgumentException  | 
                                                        |
| 617 | - */  | 
                                                        |
| 618 | - public function load_model_class($class_name, $arguments = array(), $load_only = true)  | 
                                                        |
| 619 | -    { | 
                                                        |
| 620 | - $paths = array(  | 
                                                        |
| 621 | - EE_MODELS . 'fields' . DS,  | 
                                                        |
| 622 | - EE_MODELS . 'helpers' . DS,  | 
                                                        |
| 623 | - EE_MODELS . 'relations' . DS,  | 
                                                        |
| 624 | - EE_MODELS . 'strategies' . DS,  | 
                                                        |
| 625 | - );  | 
                                                        |
| 626 | - // retrieve instantiated class  | 
                                                        |
| 627 | - return $this->_load(  | 
                                                        |
| 628 | - $paths,  | 
                                                        |
| 629 | - 'EE_',  | 
                                                        |
| 630 | - $class_name,  | 
                                                        |
| 631 | - '',  | 
                                                        |
| 632 | - $arguments,  | 
                                                        |
| 633 | - false,  | 
                                                        |
| 634 | - true,  | 
                                                        |
| 635 | - $load_only  | 
                                                        |
| 636 | - );  | 
                                                        |
| 637 | - }  | 
                                                        |
| 638 | -  | 
                                                        |
| 639 | -  | 
                                                        |
| 640 | - /**  | 
                                                        |
| 641 | - * Determines if $model_name is the name of an actual EE model.  | 
                                                        |
| 642 | - *  | 
                                                        |
| 643 | - * @param string $model_name like Event, Attendee, Question_Group_Question, etc.  | 
                                                        |
| 644 | - * @return boolean  | 
                                                        |
| 645 | - */  | 
                                                        |
| 646 | - public function is_model_name($model_name)  | 
                                                        |
| 647 | -    { | 
                                                        |
| 648 | - return isset($this->models[ $model_name ]);  | 
                                                        |
| 649 | - }  | 
                                                        |
| 650 | -  | 
                                                        |
| 651 | -  | 
                                                        |
| 652 | - /**  | 
                                                        |
| 653 | - * generic class loader  | 
                                                        |
| 654 | - *  | 
                                                        |
| 655 | - * @param string $path_to_file - directory path to file location, not including filename  | 
                                                        |
| 656 | - * @param string $file_name - file name ie: my_file.php, including extension  | 
                                                        |
| 657 | - * @param string $type - file type - core? class? helper? model?  | 
                                                        |
| 658 | - * @param mixed $arguments  | 
                                                        |
| 659 | - * @param bool $load_only  | 
                                                        |
| 660 | - * @return mixed  | 
                                                        |
| 661 | - * @throws InvalidInterfaceException  | 
                                                        |
| 662 | - * @throws InvalidDataTypeException  | 
                                                        |
| 663 | - * @throws EE_Error  | 
                                                        |
| 664 | - * @throws ReflectionException  | 
                                                        |
| 665 | - * @throws InvalidArgumentException  | 
                                                        |
| 666 | - */  | 
                                                        |
| 667 | - public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true)  | 
                                                        |
| 668 | -    { | 
                                                        |
| 669 | - // retrieve instantiated class  | 
                                                        |
| 670 | - return $this->_load(  | 
                                                        |
| 671 | - $path_to_file,  | 
                                                        |
| 672 | - '',  | 
                                                        |
| 673 | - $file_name,  | 
                                                        |
| 674 | - $type,  | 
                                                        |
| 675 | - $arguments,  | 
                                                        |
| 676 | - false,  | 
                                                        |
| 677 | - true,  | 
                                                        |
| 678 | - $load_only  | 
                                                        |
| 679 | - );  | 
                                                        |
| 680 | - }  | 
                                                        |
| 681 | -  | 
                                                        |
| 682 | -  | 
                                                        |
| 683 | - /**  | 
                                                        |
| 684 | - * @param string $path_to_file - directory path to file location, not including filename  | 
                                                        |
| 685 | - * @param string $class_name - full class name ie: My_Class  | 
                                                        |
| 686 | - * @param string $type - file type - core? class? helper? model?  | 
                                                        |
| 687 | - * @param mixed $arguments  | 
                                                        |
| 688 | - * @param bool $load_only  | 
                                                        |
| 689 | - * @return bool|EE_Addon|object  | 
                                                        |
| 690 | - * @throws InvalidInterfaceException  | 
                                                        |
| 691 | - * @throws InvalidDataTypeException  | 
                                                        |
| 692 | - * @throws EE_Error  | 
                                                        |
| 693 | - * @throws ReflectionException  | 
                                                        |
| 694 | - * @throws InvalidArgumentException  | 
                                                        |
| 695 | - */  | 
                                                        |
| 696 | - public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false)  | 
                                                        |
| 697 | -    { | 
                                                        |
| 698 | - // retrieve instantiated class  | 
                                                        |
| 699 | - return $this->_load(  | 
                                                        |
| 700 | - $path_to_file,  | 
                                                        |
| 701 | - 'addon',  | 
                                                        |
| 702 | - $class_name,  | 
                                                        |
| 703 | - $type,  | 
                                                        |
| 704 | - $arguments,  | 
                                                        |
| 705 | - false,  | 
                                                        |
| 706 | - true,  | 
                                                        |
| 707 | - $load_only  | 
                                                        |
| 708 | - );  | 
                                                        |
| 709 | - }  | 
                                                        |
| 710 | -  | 
                                                        |
| 711 | -  | 
                                                        |
| 712 | - /**  | 
                                                        |
| 713 | - * instantiates, caches, and automatically resolves dependencies  | 
                                                        |
| 714 | - * for classes that use a Fully Qualified Class Name.  | 
                                                        |
| 715 | - * if the class is not capable of being loaded using PSR-4 autoloading,  | 
                                                        |
| 716 | - * then you need to use one of the existing load_*() methods  | 
                                                        |
| 717 | - * which can resolve the classname and filepath from the passed arguments  | 
                                                        |
| 718 | - *  | 
                                                        |
| 719 | - * @param bool|string $class_name Fully Qualified Class Name  | 
                                                        |
| 720 | - * @param array $arguments an argument, or array of arguments to pass to the class upon instantiation  | 
                                                        |
| 721 | - * @param bool $cache whether to cache the instantiated object for reuse  | 
                                                        |
| 722 | - * @param bool $from_db some classes are instantiated from the db  | 
                                                        |
| 723 | - * and thus call a different method to instantiate  | 
                                                        |
| 724 | - * @param bool $load_only if true, will only load the file, but will NOT instantiate an object  | 
                                                        |
| 725 | - * @param bool|string $addon if true, will cache the object in the EE_Registry->$addons array  | 
                                                        |
| 726 | - * @return bool|null|mixed null = failure to load or instantiate class object.  | 
                                                        |
| 727 | - * object = class loaded and instantiated successfully.  | 
                                                        |
| 728 | - * bool = fail or success when $load_only is true  | 
                                                        |
| 729 | - * @throws InvalidInterfaceException  | 
                                                        |
| 730 | - * @throws InvalidDataTypeException  | 
                                                        |
| 731 | - * @throws EE_Error  | 
                                                        |
| 732 | - * @throws ReflectionException  | 
                                                        |
| 733 | - * @throws InvalidArgumentException  | 
                                                        |
| 734 | - */  | 
                                                        |
| 735 | - public function create(  | 
                                                        |
| 736 | - $class_name = false,  | 
                                                        |
| 737 | - $arguments = array(),  | 
                                                        |
| 738 | - $cache = false,  | 
                                                        |
| 739 | - $from_db = false,  | 
                                                        |
| 740 | - $load_only = false,  | 
                                                        |
| 741 | - $addon = false  | 
                                                        |
| 742 | -    ) { | 
                                                        |
| 743 | - $class_name = ltrim($class_name, '\\');  | 
                                                        |
| 744 | - $class_name = $this->class_cache->getFqnForAlias($class_name);  | 
                                                        |
| 745 | - $class_exists = $this->loadOrVerifyClassExists($class_name, $arguments);  | 
                                                        |
| 746 | - // if a non-FQCN was passed, then  | 
                                                        |
| 747 | - // verifyClassExists() might return an object  | 
                                                        |
| 748 | - // or it could return null if the class just could not be found anywhere  | 
                                                        |
| 749 | -        if ($class_exists instanceof $class_name || $class_exists === null) { | 
                                                        |
| 750 | - // either way, return the results  | 
                                                        |
| 751 | - return $class_exists;  | 
                                                        |
| 752 | - }  | 
                                                        |
| 753 | - $class_name = $class_exists;  | 
                                                        |
| 754 | - // if we're only loading the class and it already exists, then let's just return true immediately  | 
                                                        |
| 755 | -        if ($load_only) { | 
                                                        |
| 756 | - return true;  | 
                                                        |
| 757 | - }  | 
                                                        |
| 758 | - $addon = $addon ? 'addon' : '';  | 
                                                        |
| 759 | - // $this->_cache_on is toggled during the recursive loading that can occur with dependency injection  | 
                                                        |
| 760 | - // $cache is controlled by individual calls to separate Registry loader methods like load_class()  | 
                                                        |
| 761 | - // $load_only is also controlled by individual calls to separate Registry loader methods like load_file()  | 
                                                        |
| 762 | -        if ($this->_cache_on && $cache && ! $load_only) { | 
                                                        |
| 763 | - // return object if it's already cached  | 
                                                        |
| 764 | - $cached_class = $this->_get_cached_class($class_name, $addon, $arguments);  | 
                                                        |
| 765 | -            if ($cached_class !== null) { | 
                                                        |
| 766 | - return $cached_class;  | 
                                                        |
| 767 | - }  | 
                                                        |
| 768 | - }// obtain the loader method from the dependency map  | 
                                                        |
| 769 | - $loader = $this->_dependency_map->class_loader($class_name);// instantiate the requested object  | 
                                                        |
| 770 | -        if ($loader instanceof Closure) { | 
                                                        |
| 771 | - $class_obj = $loader($arguments);  | 
                                                        |
| 772 | -        } else { | 
                                                        |
| 773 | -            if ($loader && method_exists($this, $loader)) { | 
                                                        |
| 774 | -                $class_obj = $this->{$loader}($class_name, $arguments); | 
                                                        |
| 775 | -            } else { | 
                                                        |
| 776 | - $class_obj = $this->_create_object($class_name, $arguments, $addon, $from_db);  | 
                                                        |
| 777 | - }  | 
                                                        |
| 778 | - }  | 
                                                        |
| 779 | -        if (($this->_cache_on && $cache) || $this->get_class_abbreviation($class_name, '')) { | 
                                                        |
| 780 | -            // save it for later... kinda like gum  { : $ | 
                                                        |
| 781 | - $this->_set_cached_class(  | 
                                                        |
| 782 | - $class_obj,  | 
                                                        |
| 783 | - $class_name,  | 
                                                        |
| 784 | - $addon,  | 
                                                        |
| 785 | - $from_db,  | 
                                                        |
| 786 | - $arguments  | 
                                                        |
| 787 | - );  | 
                                                        |
| 788 | - }  | 
                                                        |
| 789 | - $this->_cache_on = true;  | 
                                                        |
| 790 | - return $class_obj;  | 
                                                        |
| 791 | - }  | 
                                                        |
| 792 | -  | 
                                                        |
| 793 | -  | 
                                                        |
| 794 | - /**  | 
                                                        |
| 795 | - * Recursively checks that a class exists and potentially attempts to load classes with non-FQCNs  | 
                                                        |
| 796 | - *  | 
                                                        |
| 797 | - * @param string|object $class_name  | 
                                                        |
| 798 | - * @param array $arguments  | 
                                                        |
| 799 | - * @param int $attempt  | 
                                                        |
| 800 | - * @return mixed  | 
                                                        |
| 801 | - */  | 
                                                        |
| 802 | - private function loadOrVerifyClassExists($class_name, array $arguments, $attempt = 1)  | 
                                                        |
| 803 | -    { | 
                                                        |
| 804 | -        if (is_object($class_name) || class_exists($class_name)) { | 
                                                        |
| 805 | - return $class_name;  | 
                                                        |
| 806 | - }  | 
                                                        |
| 807 | -        switch ($attempt) { | 
                                                        |
| 808 | - case 1:  | 
                                                        |
| 809 | - // if it's a FQCN then maybe the class is registered with a preceding \  | 
                                                        |
| 810 | - $class_name = strpos($class_name, '\\') !== false  | 
                                                        |
| 811 | - ? '\\' . ltrim($class_name, '\\')  | 
                                                        |
| 812 | - : $class_name;  | 
                                                        |
| 813 | - break;  | 
                                                        |
| 814 | - case 2:  | 
                                                        |
| 815 | - //  | 
                                                        |
| 816 | - $loader = $this->_dependency_map->class_loader($class_name);  | 
                                                        |
| 817 | -                if ($loader && method_exists($this, $loader)) { | 
                                                        |
| 818 | -                    return $this->{$loader}($class_name, $arguments); | 
                                                        |
| 819 | - }  | 
                                                        |
| 820 | - break;  | 
                                                        |
| 821 | - case 3:  | 
                                                        |
| 822 | - default;  | 
                                                        |
| 823 | - return null;  | 
                                                        |
| 824 | - }  | 
                                                        |
| 825 | - $attempt++;  | 
                                                        |
| 826 | - return $this->loadOrVerifyClassExists($class_name, $arguments, $attempt);  | 
                                                        |
| 827 | - }  | 
                                                        |
| 828 | -  | 
                                                        |
| 829 | -  | 
                                                        |
| 830 | - /**  | 
                                                        |
| 831 | - * instantiates, caches, and injects dependencies for classes  | 
                                                        |
| 832 | - *  | 
                                                        |
| 833 | - * @param array $file_paths an array of paths to folders to look in  | 
                                                        |
| 834 | - * @param string $class_prefix EE or EEM or... ???  | 
                                                        |
| 835 | - * @param bool|string $class_name $class name  | 
                                                        |
| 836 | - * @param string $type file type - core? class? helper? model?  | 
                                                        |
| 837 | - * @param mixed $arguments an argument or array of arguments to pass to the class upon instantiation  | 
                                                        |
| 838 | - * @param bool $from_db some classes are instantiated from the db  | 
                                                        |
| 839 | - * and thus call a different method to instantiate  | 
                                                        |
| 840 | - * @param bool $cache whether to cache the instantiated object for reuse  | 
                                                        |
| 841 | - * @param bool $load_only if true, will only load the file, but will NOT instantiate an object  | 
                                                        |
| 842 | - * @return bool|null|object null = failure to load or instantiate class object.  | 
                                                        |
| 843 | - * object = class loaded and instantiated successfully.  | 
                                                        |
| 844 | - * bool = fail or success when $load_only is true  | 
                                                        |
| 845 | - * @throws EE_Error  | 
                                                        |
| 846 | - * @throws ReflectionException  | 
                                                        |
| 847 | - * @throws InvalidInterfaceException  | 
                                                        |
| 848 | - * @throws InvalidDataTypeException  | 
                                                        |
| 849 | - * @throws InvalidArgumentException  | 
                                                        |
| 850 | - */  | 
                                                        |
| 851 | - protected function _load(  | 
                                                        |
| 852 | - $file_paths = array(),  | 
                                                        |
| 853 | - $class_prefix = 'EE_',  | 
                                                        |
| 854 | - $class_name = false,  | 
                                                        |
| 855 | - $type = 'class',  | 
                                                        |
| 856 | - $arguments = array(),  | 
                                                        |
| 857 | - $from_db = false,  | 
                                                        |
| 858 | - $cache = true,  | 
                                                        |
| 859 | - $load_only = false  | 
                                                        |
| 860 | -    ) { | 
                                                        |
| 861 | - $class_name = ltrim($class_name, '\\');  | 
                                                        |
| 862 | - // strip php file extension  | 
                                                        |
| 863 | -        $class_name = str_replace('.php', '', trim($class_name)); | 
                                                        |
| 864 | - // does the class have a prefix ?  | 
                                                        |
| 865 | -        if (! empty($class_prefix) && $class_prefix !== 'addon') { | 
                                                        |
| 866 | - // make sure $class_prefix is uppercase  | 
                                                        |
| 867 | - $class_prefix = strtoupper(trim($class_prefix));  | 
                                                        |
| 868 | - // add class prefix ONCE!!!  | 
                                                        |
| 869 | - $class_name = $class_prefix . str_replace($class_prefix, '', $class_name);  | 
                                                        |
| 870 | - }  | 
                                                        |
| 871 | - $class_name = $this->class_cache->getFqnForAlias($class_name);  | 
                                                        |
| 872 | - $class_exists = class_exists($class_name, false);  | 
                                                        |
| 873 | - // if we're only loading the class and it already exists, then let's just return true immediately  | 
                                                        |
| 874 | -        if ($load_only && $class_exists) { | 
                                                        |
| 875 | - return true;  | 
                                                        |
| 876 | - }  | 
                                                        |
| 877 | - $arguments = is_array($arguments) ? $arguments : array($arguments);  | 
                                                        |
| 878 | - // $this->_cache_on is toggled during the recursive loading that can occur with dependency injection  | 
                                                        |
| 879 | - // $cache is controlled by individual calls to separate Registry loader methods like load_class()  | 
                                                        |
| 880 | - // $load_only is also controlled by individual calls to separate Registry loader methods like load_file()  | 
                                                        |
| 881 | -        if ($this->_cache_on && $cache && ! $load_only) { | 
                                                        |
| 882 | - // return object if it's already cached  | 
                                                        |
| 883 | - $cached_class = $this->_get_cached_class($class_name, $class_prefix, $arguments);  | 
                                                        |
| 884 | -            if ($cached_class !== null) { | 
                                                        |
| 885 | - return $cached_class;  | 
                                                        |
| 886 | - }  | 
                                                        |
| 887 | - }  | 
                                                        |
| 888 | - // if the class doesn't already exist.. then we need to try and find the file and load it  | 
                                                        |
| 889 | -        if (! $class_exists) { | 
                                                        |
| 890 | - // get full path to file  | 
                                                        |
| 891 | - $path = $this->_resolve_path($class_name, $type, $file_paths);  | 
                                                        |
| 892 | - // load the file  | 
                                                        |
| 893 | - $loaded = $this->_require_file($path, $class_name, $type, $file_paths);  | 
                                                        |
| 894 | - // if we are only loading a file but NOT instantiating an object  | 
                                                        |
| 895 | - // then return boolean for whether class was loaded or not  | 
                                                        |
| 896 | -            if ($load_only) { | 
                                                        |
| 897 | - return $loaded;  | 
                                                        |
| 898 | - }  | 
                                                        |
| 899 | - // if an object was expected but loading failed, then return nothing  | 
                                                        |
| 900 | -            if (! $loaded) { | 
                                                        |
| 901 | - return null;  | 
                                                        |
| 902 | - }  | 
                                                        |
| 903 | - }  | 
                                                        |
| 904 | - // instantiate the requested object  | 
                                                        |
| 905 | - $class_obj = $this->_create_object($class_name, $arguments, $type, $from_db);  | 
                                                        |
| 906 | -        if ($this->_cache_on && $cache) { | 
                                                        |
| 907 | -            // save it for later... kinda like gum  { : $ | 
                                                        |
| 908 | - $this->_set_cached_class(  | 
                                                        |
| 909 | - $class_obj,  | 
                                                        |
| 910 | - $class_name,  | 
                                                        |
| 911 | - $class_prefix,  | 
                                                        |
| 912 | - $from_db,  | 
                                                        |
| 913 | - $arguments  | 
                                                        |
| 914 | - );  | 
                                                        |
| 915 | - }  | 
                                                        |
| 916 | - $this->_cache_on = true;  | 
                                                        |
| 917 | - return $class_obj;  | 
                                                        |
| 918 | - }  | 
                                                        |
| 919 | -  | 
                                                        |
| 920 | -  | 
                                                        |
| 921 | - /**  | 
                                                        |
| 922 | - * @param string $class_name  | 
                                                        |
| 923 | - * @param string $default have to specify something, but not anything that will conflict  | 
                                                        |
| 924 | - * @return mixed|string  | 
                                                        |
| 925 | - */  | 
                                                        |
| 926 | - protected function get_class_abbreviation($class_name, $default = 'FANCY_BATMAN_PANTS')  | 
                                                        |
| 927 | -    { | 
                                                        |
| 928 | - return isset($this->_class_abbreviations[ $class_name ])  | 
                                                        |
| 929 | - ? $this->_class_abbreviations[ $class_name ]  | 
                                                        |
| 930 | - : $default;  | 
                                                        |
| 931 | - }  | 
                                                        |
| 932 | -  | 
                                                        |
| 933 | -  | 
                                                        |
| 934 | - /**  | 
                                                        |
| 935 | - * attempts to find a cached version of the requested class  | 
                                                        |
| 936 | - * by looking in the following places:  | 
                                                        |
| 937 | -     *        $this->{$class_abbreviation}            ie:    $this->CART | 
                                                        |
| 938 | -     *        $this->{$class_name}                        ie:    $this->Some_Class | 
                                                        |
| 939 | -     *        $this->LIB->{$class_name}                ie:    $this->LIB->Some_Class | 
                                                        |
| 940 | -     *        $this->addon->{$class_name}    ie:    $this->addon->Some_Addon_Class | 
                                                        |
| 941 | - *  | 
                                                        |
| 942 | - * @param string $class_name  | 
                                                        |
| 943 | - * @param string $class_prefix  | 
                                                        |
| 944 | - * @param array $arguments  | 
                                                        |
| 945 | - * @return mixed  | 
                                                        |
| 946 | - */  | 
                                                        |
| 947 | - protected function _get_cached_class(  | 
                                                        |
| 948 | - $class_name,  | 
                                                        |
| 949 | - $class_prefix = '',  | 
                                                        |
| 950 | - $arguments = array()  | 
                                                        |
| 951 | -    ) { | 
                                                        |
| 952 | -        if ($class_name === 'EE_Registry') { | 
                                                        |
| 953 | - return $this;  | 
                                                        |
| 954 | - }  | 
                                                        |
| 955 | - $class_abbreviation = $this->get_class_abbreviation($class_name);  | 
                                                        |
| 956 | - // check if class has already been loaded, and return it if it has been  | 
                                                        |
| 957 | -        if (isset($this->{$class_abbreviation})) { | 
                                                        |
| 958 | -            return $this->{$class_abbreviation}; | 
                                                        |
| 959 | - }  | 
                                                        |
| 960 | -        $class_name = str_replace('\\', '_', $class_name); | 
                                                        |
| 961 | -        if (isset ($this->{$class_name})) { | 
                                                        |
| 962 | -            return $this->{$class_name}; | 
                                                        |
| 963 | - }  | 
                                                        |
| 964 | -        if ($class_prefix === 'addon' && isset ($this->addons->{$class_name})) { | 
                                                        |
| 965 | -            return $this->addons->{$class_name}; | 
                                                        |
| 966 | - }  | 
                                                        |
| 967 | - $object_identifier = $this->object_identifier->getIdentifier($class_name, $arguments);  | 
                                                        |
| 968 | -        if (isset($this->LIB->{$object_identifier})) { | 
                                                        |
| 969 | -            return $this->LIB->{$object_identifier}; | 
                                                        |
| 970 | - }  | 
                                                        |
| 971 | -        foreach ($this->LIB as $key => $object) { | 
                                                        |
| 972 | - if (  | 
                                                        |
| 973 | - // request does not contain new arguments and therefore no args identifier  | 
                                                        |
| 974 | - ! $this->object_identifier->hasArguments($object_identifier)  | 
                                                        |
| 975 | - // but previously cached class with args was found  | 
                                                        |
| 976 | - && $this->object_identifier->fqcnMatchesObjectIdentifier($class_name, $key)  | 
                                                        |
| 977 | -            ) { | 
                                                        |
| 978 | - return $object;  | 
                                                        |
| 979 | - }  | 
                                                        |
| 980 | - }  | 
                                                        |
| 981 | - return null;  | 
                                                        |
| 982 | - }  | 
                                                        |
| 983 | -  | 
                                                        |
| 984 | -  | 
                                                        |
| 985 | - /**  | 
                                                        |
| 986 | - * removes a cached version of the requested class  | 
                                                        |
| 987 | - *  | 
                                                        |
| 988 | - * @param string $class_name  | 
                                                        |
| 989 | - * @param boolean $addon  | 
                                                        |
| 990 | - * @param array $arguments  | 
                                                        |
| 991 | - * @return boolean  | 
                                                        |
| 992 | - */  | 
                                                        |
| 993 | - public function clear_cached_class(  | 
                                                        |
| 994 | - $class_name,  | 
                                                        |
| 995 | - $addon = false,  | 
                                                        |
| 996 | - $arguments = array()  | 
                                                        |
| 997 | -    ) { | 
                                                        |
| 998 | - $class_abbreviation = $this->get_class_abbreviation($class_name);  | 
                                                        |
| 999 | - // check if class has already been loaded, and return it if it has been  | 
                                                        |
| 1000 | -        if (isset($this->{$class_abbreviation})) { | 
                                                        |
| 1001 | -            $this->{$class_abbreviation} = null; | 
                                                        |
| 1002 | - return true;  | 
                                                        |
| 1003 | - }  | 
                                                        |
| 1004 | -        $class_name = str_replace('\\', '_', $class_name); | 
                                                        |
| 1005 | -        if (isset($this->{$class_name})) { | 
                                                        |
| 1006 | -            $this->{$class_name} = null; | 
                                                        |
| 1007 | - return true;  | 
                                                        |
| 1008 | - }  | 
                                                        |
| 1009 | -        if ($addon && isset($this->addons->{$class_name})) { | 
                                                        |
| 1010 | -            unset($this->addons->{$class_name}); | 
                                                        |
| 1011 | - return true;  | 
                                                        |
| 1012 | - }  | 
                                                        |
| 1013 | - $class_name = $this->object_identifier->getIdentifier($class_name, $arguments);  | 
                                                        |
| 1014 | -        if (isset($this->LIB->{$class_name})) { | 
                                                        |
| 1015 | -            unset($this->LIB->{$class_name}); | 
                                                        |
| 1016 | - return true;  | 
                                                        |
| 1017 | - }  | 
                                                        |
| 1018 | - return false;  | 
                                                        |
| 1019 | - }  | 
                                                        |
| 1020 | -  | 
                                                        |
| 1021 | -  | 
                                                        |
| 1022 | - /**  | 
                                                        |
| 1023 | - * _set_cached_class  | 
                                                        |
| 1024 | - * attempts to cache the instantiated class locally  | 
                                                        |
| 1025 | - * in one of the following places, in the following order:  | 
                                                        |
| 1026 | -     *        $this->{class_abbreviation}   ie:    $this->CART | 
                                                        |
| 1027 | -     *        $this->{$class_name}          ie:    $this->Some_Class | 
                                                        |
| 1028 | -     *        $this->addon->{$$class_name}    ie:    $this->addon->Some_Addon_Class | 
                                                        |
| 1029 | -     *        $this->LIB->{$class_name}     ie:    $this->LIB->Some_Class | 
                                                        |
| 1030 | - *  | 
                                                        |
| 1031 | - * @param object $class_obj  | 
                                                        |
| 1032 | - * @param string $class_name  | 
                                                        |
| 1033 | - * @param string $class_prefix  | 
                                                        |
| 1034 | - * @param bool $from_db  | 
                                                        |
| 1035 | - * @param array $arguments  | 
                                                        |
| 1036 | - * @return void  | 
                                                        |
| 1037 | - */  | 
                                                        |
| 1038 | - protected function _set_cached_class(  | 
                                                        |
| 1039 | - $class_obj,  | 
                                                        |
| 1040 | - $class_name,  | 
                                                        |
| 1041 | - $class_prefix = '',  | 
                                                        |
| 1042 | - $from_db = false,  | 
                                                        |
| 1043 | - $arguments = array()  | 
                                                        |
| 1044 | -    ) { | 
                                                        |
| 1045 | -        if ($class_name === 'EE_Registry' || empty($class_obj)) { | 
                                                        |
| 1046 | - return;  | 
                                                        |
| 1047 | - }  | 
                                                        |
| 1048 | - // return newly instantiated class  | 
                                                        |
| 1049 | - $class_abbreviation = $this->get_class_abbreviation($class_name, '');  | 
                                                        |
| 1050 | -        if ($class_abbreviation) { | 
                                                        |
| 1051 | -            $this->{$class_abbreviation} = $class_obj; | 
                                                        |
| 1052 | - return;  | 
                                                        |
| 1053 | - }  | 
                                                        |
| 1054 | -        $class_name = str_replace('\\', '_', $class_name); | 
                                                        |
| 1055 | -        if (property_exists($this, $class_name)) { | 
                                                        |
| 1056 | -            $this->{$class_name} = $class_obj; | 
                                                        |
| 1057 | - return;  | 
                                                        |
| 1058 | - }  | 
                                                        |
| 1059 | -        if ($class_prefix === 'addon') { | 
                                                        |
| 1060 | -            $this->addons->{$class_name} = $class_obj; | 
                                                        |
| 1061 | - return;  | 
                                                        |
| 1062 | - }  | 
                                                        |
| 1063 | -        if (! $from_db) { | 
                                                        |
| 1064 | - $class_name = $this->object_identifier->getIdentifier($class_name, $arguments);  | 
                                                        |
| 1065 | -            $this->LIB->{$class_name} = $class_obj; | 
                                                        |
| 1066 | - }  | 
                                                        |
| 1067 | - }  | 
                                                        |
| 1068 | -  | 
                                                        |
| 1069 | -  | 
                                                        |
| 1070 | - /**  | 
                                                        |
| 1071 | - * attempts to find a full valid filepath for the requested class.  | 
                                                        |
| 1072 | -     * loops thru each of the base paths in the $file_paths array and appends : "{classname} . {file type} . php" | 
                                                        |
| 1073 | - * then returns that path if the target file has been found and is readable  | 
                                                        |
| 1074 | - *  | 
                                                        |
| 1075 | - * @param string $class_name  | 
                                                        |
| 1076 | - * @param string $type  | 
                                                        |
| 1077 | - * @param array $file_paths  | 
                                                        |
| 1078 | - * @return string | bool  | 
                                                        |
| 1079 | - */  | 
                                                        |
| 1080 | - protected function _resolve_path($class_name, $type = '', $file_paths = array())  | 
                                                        |
| 1081 | -    { | 
                                                        |
| 1082 | - // make sure $file_paths is an array  | 
                                                        |
| 1083 | - $file_paths = is_array($file_paths)  | 
                                                        |
| 1084 | - ? $file_paths  | 
                                                        |
| 1085 | - : array($file_paths);  | 
                                                        |
| 1086 | - // cycle thru paths  | 
                                                        |
| 1087 | -        foreach ($file_paths as $key => $file_path) { | 
                                                        |
| 1088 | - // convert all separators to proper DS, if no filepath, then use EE_CLASSES  | 
                                                        |
| 1089 | - $file_path = $file_path  | 
                                                        |
| 1090 | -                ? str_replace(array('/', '\\'), DS, $file_path) | 
                                                        |
| 1091 | - : EE_CLASSES;  | 
                                                        |
| 1092 | - // prep file type  | 
                                                        |
| 1093 | - $type = ! empty($type)  | 
                                                        |
| 1094 | - ? trim($type, '.') . '.'  | 
                                                        |
| 1095 | - : '';  | 
                                                        |
| 1096 | - // build full file path  | 
                                                        |
| 1097 | - $file_paths[ $key ] = rtrim($file_path, DS) . DS . $class_name . '.' . $type . 'php';  | 
                                                        |
| 1098 | - //does the file exist and can be read ?  | 
                                                        |
| 1099 | -            if (is_readable($file_paths[ $key ])) { | 
                                                        |
| 1100 | - return $file_paths[ $key ];  | 
                                                        |
| 1101 | - }  | 
                                                        |
| 1102 | - }  | 
                                                        |
| 1103 | - return false;  | 
                                                        |
| 1104 | - }  | 
                                                        |
| 1105 | -  | 
                                                        |
| 1106 | -  | 
                                                        |
| 1107 | - /**  | 
                                                        |
| 1108 | - * basically just performs a require_once()  | 
                                                        |
| 1109 | - * but with some error handling  | 
                                                        |
| 1110 | - *  | 
                                                        |
| 1111 | - * @param string $path  | 
                                                        |
| 1112 | - * @param string $class_name  | 
                                                        |
| 1113 | - * @param string $type  | 
                                                        |
| 1114 | - * @param array $file_paths  | 
                                                        |
| 1115 | - * @return bool  | 
                                                        |
| 1116 | - * @throws EE_Error  | 
                                                        |
| 1117 | - * @throws ReflectionException  | 
                                                        |
| 1118 | - */  | 
                                                        |
| 1119 | - protected function _require_file($path, $class_name, $type = '', $file_paths = array())  | 
                                                        |
| 1120 | -    { | 
                                                        |
| 1121 | - $this->resolve_legacy_class_parent($class_name);  | 
                                                        |
| 1122 | - // don't give up! you gotta...  | 
                                                        |
| 1123 | -        try { | 
                                                        |
| 1124 | - //does the file exist and can it be read ?  | 
                                                        |
| 1125 | -            if (! $path) { | 
                                                        |
| 1126 | - // just in case the file has already been autoloaded,  | 
                                                        |
| 1127 | - // but discrepancies in the naming schema are preventing it from  | 
                                                        |
| 1128 | - // being loaded via one of the EE_Registry::load_*() methods,  | 
                                                        |
| 1129 | - // then let's try one last hail mary before throwing an exception  | 
                                                        |
| 1130 | - // and call class_exists() again, but with autoloading turned ON  | 
                                                        |
| 1131 | -                if (class_exists($class_name)) { | 
                                                        |
| 1132 | - return true;  | 
                                                        |
| 1133 | - }  | 
                                                        |
| 1134 | - // so sorry, can't find the file  | 
                                                        |
| 1135 | - throw new EE_Error (  | 
                                                        |
| 1136 | - sprintf(  | 
                                                        |
| 1137 | - esc_html__(  | 
                                                        |
| 1138 | - 'The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s',  | 
                                                        |
| 1139 | - 'event_espresso'  | 
                                                        |
| 1140 | - ),  | 
                                                        |
| 1141 | - trim($type, '.'),  | 
                                                        |
| 1142 | - $class_name,  | 
                                                        |
| 1143 | -                        '<br />' . implode(',<br />', $file_paths) | 
                                                        |
| 1144 | - )  | 
                                                        |
| 1145 | - );  | 
                                                        |
| 1146 | - }  | 
                                                        |
| 1147 | - // get the file  | 
                                                        |
| 1148 | - require_once($path);  | 
                                                        |
| 1149 | - // if the class isn't already declared somewhere  | 
                                                        |
| 1150 | -            if (class_exists($class_name, false) === false) { | 
                                                        |
| 1151 | - // so sorry, not a class  | 
                                                        |
| 1152 | - throw new EE_Error(  | 
                                                        |
| 1153 | - sprintf(  | 
                                                        |
| 1154 | - esc_html__(  | 
                                                        |
| 1155 | - 'The %s file %s does not appear to contain the %s Class.',  | 
                                                        |
| 1156 | - 'event_espresso'  | 
                                                        |
| 1157 | - ),  | 
                                                        |
| 1158 | - $type,  | 
                                                        |
| 1159 | - $path,  | 
                                                        |
| 1160 | - $class_name  | 
                                                        |
| 1161 | - )  | 
                                                        |
| 1162 | - );  | 
                                                        |
| 1163 | - }  | 
                                                        |
| 1164 | -        } catch (EE_Error $e) { | 
                                                        |
| 1165 | - $e->get_error();  | 
                                                        |
| 1166 | - return false;  | 
                                                        |
| 1167 | - }  | 
                                                        |
| 1168 | - return true;  | 
                                                        |
| 1169 | - }  | 
                                                        |
| 1170 | -  | 
                                                        |
| 1171 | -  | 
                                                        |
| 1172 | - /**  | 
                                                        |
| 1173 | - * Some of our legacy classes that extended a parent class would simply use a require() statement  | 
                                                        |
| 1174 | - * before their class declaration in order to ensure that the parent class was loaded.  | 
                                                        |
| 1175 | - * This is not ideal, but it's nearly impossible to determine the parent class of a non-namespaced class,  | 
                                                        |
| 1176 | - * without triggering a fatal error because the parent class has yet to be loaded and therefore doesn't exist.  | 
                                                        |
| 1177 | - *  | 
                                                        |
| 1178 | - * @param string $class_name  | 
                                                        |
| 1179 | - */  | 
                                                        |
| 1180 | - protected function resolve_legacy_class_parent($class_name = '')  | 
                                                        |
| 1181 | -    { | 
                                                        |
| 1182 | -        try { | 
                                                        |
| 1183 | - $legacy_parent_class_map = array(  | 
                                                        |
| 1184 | - 'EE_Payment_Processor' => 'core/business/EE_Processor_Base.class.php',  | 
                                                        |
| 1185 | - );  | 
                                                        |
| 1186 | -            if (isset($legacy_parent_class_map[ $class_name ])) { | 
                                                        |
| 1187 | - require_once EE_PLUGIN_DIR_PATH . $legacy_parent_class_map[ $class_name ];  | 
                                                        |
| 1188 | - }  | 
                                                        |
| 1189 | -        } catch (Exception $exception) { | 
                                                        |
| 1190 | - }  | 
                                                        |
| 1191 | - }  | 
                                                        |
| 1192 | -  | 
                                                        |
| 1193 | -  | 
                                                        |
| 1194 | - /**  | 
                                                        |
| 1195 | - * _create_object  | 
                                                        |
| 1196 | - * Attempts to instantiate the requested class via any of the  | 
                                                        |
| 1197 | - * commonly used instantiation methods employed throughout EE.  | 
                                                        |
| 1198 | - * The priority for instantiation is as follows:  | 
                                                        |
| 1199 | - * - abstract classes or any class flagged as "load only" (no instantiation occurs)  | 
                                                        |
| 1200 | - * - model objects via their 'new_instance_from_db' method  | 
                                                        |
| 1201 | - * - model objects via their 'new_instance' method  | 
                                                        |
| 1202 | - * - "singleton" classes" via their 'instance' method  | 
                                                        |
| 1203 | - * - standard instantiable classes via their __constructor  | 
                                                        |
| 1204 | - * Prior to instantiation, if the classname exists in the dependency_map,  | 
                                                        |
| 1205 | - * then the constructor for the requested class will be examined to determine  | 
                                                        |
| 1206 | - * if any dependencies exist, and if they can be injected.  | 
                                                        |
| 1207 | - * If so, then those classes will be added to the array of arguments passed to the constructor  | 
                                                        |
| 1208 | - *  | 
                                                        |
| 1209 | - * @param string $class_name  | 
                                                        |
| 1210 | - * @param array $arguments  | 
                                                        |
| 1211 | - * @param string $type  | 
                                                        |
| 1212 | - * @param bool $from_db  | 
                                                        |
| 1213 | - * @return null|object|bool  | 
                                                        |
| 1214 | - * @throws InvalidArgumentException  | 
                                                        |
| 1215 | - * @throws InvalidInterfaceException  | 
                                                        |
| 1216 | - * @throws EE_Error  | 
                                                        |
| 1217 | - * @throws ReflectionException  | 
                                                        |
| 1218 | - * @throws InvalidDataTypeException  | 
                                                        |
| 1219 | - */  | 
                                                        |
| 1220 | - protected function _create_object($class_name, $arguments = array(), $type = '', $from_db = false)  | 
                                                        |
| 1221 | -    { | 
                                                        |
| 1222 | - // create reflection  | 
                                                        |
| 1223 | - $reflector = $this->mirror->getReflectionClass($class_name);  | 
                                                        |
| 1224 | - // make sure arguments are an array  | 
                                                        |
| 1225 | - $arguments = is_array($arguments)  | 
                                                        |
| 1226 | - ? $arguments  | 
                                                        |
| 1227 | - : array($arguments);  | 
                                                        |
| 1228 | - // and if arguments array is numerically and sequentially indexed, then we want it to remain as is,  | 
                                                        |
| 1229 | - // else wrap it in an additional array so that it doesn't get split into multiple parameters  | 
                                                        |
| 1230 | - $arguments = $this->_array_is_numerically_and_sequentially_indexed($arguments)  | 
                                                        |
| 1231 | - ? $arguments  | 
                                                        |
| 1232 | - : array($arguments);  | 
                                                        |
| 1233 | - // attempt to inject dependencies ?  | 
                                                        |
| 1234 | -        if ($this->_dependency_map->has($class_name)) { | 
                                                        |
| 1235 | - $arguments = $this->_resolve_dependencies($reflector, $class_name, $arguments);  | 
                                                        |
| 1236 | - }  | 
                                                        |
| 1237 | - // instantiate the class if possible  | 
                                                        |
| 1238 | -        if ($reflector->isAbstract()) { | 
                                                        |
| 1239 | - // nothing to instantiate, loading file was enough  | 
                                                        |
| 1240 | - // does not throw an exception so $instantiation_mode is unused  | 
                                                        |
| 1241 | - // $instantiation_mode = "1) no constructor abstract class";  | 
                                                        |
| 1242 | - return true;  | 
                                                        |
| 1243 | - }  | 
                                                        |
| 1244 | - if (  | 
                                                        |
| 1245 | - empty($arguments)  | 
                                                        |
| 1246 | - && $this->mirror->getConstructorFromReflection($reflector) === null  | 
                                                        |
| 1247 | - && $reflector->isInstantiable()  | 
                                                        |
| 1248 | -        ) { | 
                                                        |
| 1249 | - // no constructor = static methods only... nothing to instantiate, loading file was enough  | 
                                                        |
| 1250 | - // $instantiation_mode = "2) no constructor but instantiable";  | 
                                                        |
| 1251 | - return $reflector->newInstance();  | 
                                                        |
| 1252 | - }  | 
                                                        |
| 1253 | -        if ($from_db && method_exists($class_name, 'new_instance_from_db')) { | 
                                                        |
| 1254 | - // $instantiation_mode = "3) new_instance_from_db()";  | 
                                                        |
| 1255 | - return call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments);  | 
                                                        |
| 1256 | - }  | 
                                                        |
| 1257 | -        if (method_exists($class_name, 'new_instance')) { | 
                                                        |
| 1258 | - // $instantiation_mode = "4) new_instance()";  | 
                                                        |
| 1259 | - return call_user_func_array(array($class_name, 'new_instance'), $arguments);  | 
                                                        |
| 1260 | - }  | 
                                                        |
| 1261 | -        if (method_exists($class_name, 'instance')) { | 
                                                        |
| 1262 | - // $instantiation_mode = "5) instance()";  | 
                                                        |
| 1263 | - return call_user_func_array(array($class_name, 'instance'), $arguments);  | 
                                                        |
| 1264 | - }  | 
                                                        |
| 1265 | -        if ($reflector->isInstantiable()) { | 
                                                        |
| 1266 | - // $instantiation_mode = "6) constructor";  | 
                                                        |
| 1267 | - return $reflector->newInstanceArgs($arguments);  | 
                                                        |
| 1268 | - }  | 
                                                        |
| 1269 | - // heh ? something's not right !  | 
                                                        |
| 1270 | - throw new EE_Error(  | 
                                                        |
| 1271 | - sprintf(  | 
                                                        |
| 1272 | -                __('The %s file %s could not be instantiated.', 'event_espresso'), | 
                                                        |
| 1273 | - $type,  | 
                                                        |
| 1274 | - $class_name  | 
                                                        |
| 1275 | - )  | 
                                                        |
| 1276 | - );  | 
                                                        |
| 1277 | - }  | 
                                                        |
| 1278 | -  | 
                                                        |
| 1279 | -  | 
                                                        |
| 1280 | - /**  | 
                                                        |
| 1281 | - * @see http://stackoverflow.com/questions/173400/how-to-check-if-php-array-is-associative-or-sequential  | 
                                                        |
| 1282 | - * @param array $array  | 
                                                        |
| 1283 | - * @return bool  | 
                                                        |
| 1284 | - */  | 
                                                        |
| 1285 | - protected function _array_is_numerically_and_sequentially_indexed(array $array)  | 
                                                        |
| 1286 | -    { | 
                                                        |
| 1287 | - return ! empty($array)  | 
                                                        |
| 1288 | - ? array_keys($array) === range(0, count($array) - 1)  | 
                                                        |
| 1289 | - : true;  | 
                                                        |
| 1290 | - }  | 
                                                        |
| 1291 | -  | 
                                                        |
| 1292 | -  | 
                                                        |
| 1293 | - /**  | 
                                                        |
| 1294 | - * _resolve_dependencies  | 
                                                        |
| 1295 | - * examines the constructor for the requested class to determine  | 
                                                        |
| 1296 | - * if any dependencies exist, and if they can be injected.  | 
                                                        |
| 1297 | - * If so, then those classes will be added to the array of arguments passed to the constructor  | 
                                                        |
| 1298 | - * PLZ NOTE: this is achieved by type hinting the constructor params  | 
                                                        |
| 1299 | - * For example:  | 
                                                        |
| 1300 | - * if attempting to load a class "Foo" with the following constructor:  | 
                                                        |
| 1301 | - * __construct( Bar $bar_class, Fighter $grohl_class )  | 
                                                        |
| 1302 | - * then $bar_class and $grohl_class will be added to the $arguments array,  | 
                                                        |
| 1303 | - * but only IF they are NOT already present in the incoming arguments array,  | 
                                                        |
| 1304 | - * and the correct classes can be loaded  | 
                                                        |
| 1305 | - *  | 
                                                        |
| 1306 | - * @param ReflectionClass $reflector  | 
                                                        |
| 1307 | - * @param string $class_name  | 
                                                        |
| 1308 | - * @param array $arguments  | 
                                                        |
| 1309 | - * @return array  | 
                                                        |
| 1310 | - * @throws InvalidArgumentException  | 
                                                        |
| 1311 | - * @throws InvalidDataTypeException  | 
                                                        |
| 1312 | - * @throws InvalidInterfaceException  | 
                                                        |
| 1313 | - * @throws ReflectionException  | 
                                                        |
| 1314 | - */  | 
                                                        |
| 1315 | - protected function _resolve_dependencies(ReflectionClass $reflector, $class_name, array $arguments = array())  | 
                                                        |
| 1316 | -    { | 
                                                        |
| 1317 | - // let's examine the constructor  | 
                                                        |
| 1318 | - $constructor = $this->mirror->getConstructorFromReflection($reflector);  | 
                                                        |
| 1319 | - // whu? huh? nothing?  | 
                                                        |
| 1320 | -        if (! $constructor) { | 
                                                        |
| 1321 | - return $arguments;  | 
                                                        |
| 1322 | - }  | 
                                                        |
| 1323 | - // get constructor parameters  | 
                                                        |
| 1324 | - $params = $this->mirror->getParametersFromReflection($reflector);  | 
                                                        |
| 1325 | - // and the keys for the incoming arguments array so that we can compare existing arguments with what is expected  | 
                                                        |
| 1326 | - $argument_keys = array_keys($arguments);  | 
                                                        |
| 1327 | - // now loop thru all of the constructors expected parameters  | 
                                                        |
| 1328 | -        foreach ($params as $index => $param) { | 
                                                        |
| 1329 | - // is this a dependency for a specific class ?  | 
                                                        |
| 1330 | - $param_class = $this->mirror->getParameterClassName($param, $class_name, $index);  | 
                                                        |
| 1331 | - // BUT WAIT !!! This class may be an alias for something else (or getting replaced at runtime)  | 
                                                        |
| 1332 | - $param_class = $this->class_cache->isAlias($param_class, $class_name)  | 
                                                        |
| 1333 | - ? $this->class_cache->getFqnForAlias($param_class, $class_name)  | 
                                                        |
| 1334 | - : $param_class;  | 
                                                        |
| 1335 | - if (  | 
                                                        |
| 1336 | - // param is not even a class  | 
                                                        |
| 1337 | - $param_class === null  | 
                                                        |
| 1338 | - // and something already exists in the incoming arguments for this param  | 
                                                        |
| 1339 | - && array_key_exists($index, $argument_keys)  | 
                                                        |
| 1340 | - && array_key_exists($argument_keys[ $index ], $arguments)  | 
                                                        |
| 1341 | -            ) { | 
                                                        |
| 1342 | - // so let's skip this argument and move on to the next  | 
                                                        |
| 1343 | - continue;  | 
                                                        |
| 1344 | - }  | 
                                                        |
| 1345 | - if (  | 
                                                        |
| 1346 | - // parameter is type hinted as a class, exists as an incoming argument, AND it's the correct class  | 
                                                        |
| 1347 | - $param_class !== null  | 
                                                        |
| 1348 | - && isset($argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ])  | 
                                                        |
| 1349 | - && $arguments[ $argument_keys[ $index ] ] instanceof $param_class  | 
                                                        |
| 1350 | -            ) { | 
                                                        |
| 1351 | - // skip this argument and move on to the next  | 
                                                        |
| 1352 | - continue;  | 
                                                        |
| 1353 | - }  | 
                                                        |
| 1354 | - if (  | 
                                                        |
| 1355 | - // parameter is type hinted as a class, and should be injected  | 
                                                        |
| 1356 | - $param_class !== null  | 
                                                        |
| 1357 | - && $this->_dependency_map->has_dependency_for_class($class_name, $param_class)  | 
                                                        |
| 1358 | -            ) { | 
                                                        |
| 1359 | - $arguments = $this->_resolve_dependency(  | 
                                                        |
| 1360 | - $class_name,  | 
                                                        |
| 1361 | - $param_class,  | 
                                                        |
| 1362 | - $arguments,  | 
                                                        |
| 1363 | - $index  | 
                                                        |
| 1364 | - );  | 
                                                        |
| 1365 | -            } else { | 
                                                        |
| 1366 | - $arguments[ $index ] = $this->mirror->getParameterDefaultValue(  | 
                                                        |
| 1367 | - $param,  | 
                                                        |
| 1368 | - $class_name,  | 
                                                        |
| 1369 | - $index  | 
                                                        |
| 1370 | - );  | 
                                                        |
| 1371 | - }  | 
                                                        |
| 1372 | - }  | 
                                                        |
| 1373 | - return $arguments;  | 
                                                        |
| 1374 | - }  | 
                                                        |
| 1375 | -  | 
                                                        |
| 1376 | -  | 
                                                        |
| 1377 | - /**  | 
                                                        |
| 1378 | - * @param string $class_name  | 
                                                        |
| 1379 | - * @param string $param_class  | 
                                                        |
| 1380 | - * @param array $arguments  | 
                                                        |
| 1381 | - * @param mixed $index  | 
                                                        |
| 1382 | - * @return array  | 
                                                        |
| 1383 | - * @throws InvalidArgumentException  | 
                                                        |
| 1384 | - * @throws InvalidInterfaceException  | 
                                                        |
| 1385 | - * @throws InvalidDataTypeException  | 
                                                        |
| 1386 | - */  | 
                                                        |
| 1387 | - protected function _resolve_dependency($class_name, $param_class, $arguments, $index)  | 
                                                        |
| 1388 | -    { | 
                                                        |
| 1389 | - $dependency = null;  | 
                                                        |
| 1390 | - // should dependency be loaded from cache ?  | 
                                                        |
| 1391 | - $cache_on = $this->_dependency_map->loading_strategy_for_class_dependency(  | 
                                                        |
| 1392 | - $class_name,  | 
                                                        |
| 1393 | - $param_class  | 
                                                        |
| 1394 | - );  | 
                                                        |
| 1395 | - $cache_on = $cache_on !== EE_Dependency_Map::load_new_object;  | 
                                                        |
| 1396 | - // we might have a dependency...  | 
                                                        |
| 1397 | - // let's MAYBE try and find it in our cache if that's what's been requested  | 
                                                        |
| 1398 | - $cached_class = $cache_on  | 
                                                        |
| 1399 | - ? $this->_get_cached_class($param_class)  | 
                                                        |
| 1400 | - : null;  | 
                                                        |
| 1401 | - // and grab it if it exists  | 
                                                        |
| 1402 | -        if ($cached_class instanceof $param_class) { | 
                                                        |
| 1403 | - $dependency = $cached_class;  | 
                                                        |
| 1404 | -        } elseif ($param_class !== $class_name) { | 
                                                        |
| 1405 | - // obtain the loader method from the dependency map  | 
                                                        |
| 1406 | - $loader = $this->_dependency_map->class_loader($param_class);  | 
                                                        |
| 1407 | - // is loader a custom closure ?  | 
                                                        |
| 1408 | -            if ($loader instanceof Closure) { | 
                                                        |
| 1409 | - $dependency = $loader($arguments);  | 
                                                        |
| 1410 | -            } else { | 
                                                        |
| 1411 | - // set the cache on property for the recursive loading call  | 
                                                        |
| 1412 | - $this->_cache_on = $cache_on;  | 
                                                        |
| 1413 | - // if not, then let's try and load it via the registry  | 
                                                        |
| 1414 | -                if ($loader && method_exists($this, $loader)) { | 
                                                        |
| 1415 | -                    $dependency = $this->{$loader}($param_class); | 
                                                        |
| 1416 | -                } else { | 
                                                        |
| 1417 | - $dependency = LoaderFactory::getLoader()->load(  | 
                                                        |
| 1418 | - $param_class,  | 
                                                        |
| 1419 | - array(),  | 
                                                        |
| 1420 | - $cache_on  | 
                                                        |
| 1421 | - );  | 
                                                        |
| 1422 | - }  | 
                                                        |
| 1423 | - }  | 
                                                        |
| 1424 | - }  | 
                                                        |
| 1425 | - // did we successfully find the correct dependency ?  | 
                                                        |
| 1426 | -        if ($dependency instanceof $param_class) { | 
                                                        |
| 1427 | - // then let's inject it into the incoming array of arguments at the correct location  | 
                                                        |
| 1428 | - $arguments[ $index ] = $dependency;  | 
                                                        |
| 1429 | - }  | 
                                                        |
| 1430 | - return $arguments;  | 
                                                        |
| 1431 | - }  | 
                                                        |
| 1432 | -  | 
                                                        |
| 1433 | -  | 
                                                        |
| 1434 | - /**  | 
                                                        |
| 1435 | - * call any loader that's been registered in the EE_Dependency_Map::$_class_loaders array  | 
                                                        |
| 1436 | - *  | 
                                                        |
| 1437 | - * @param string $classname PLEASE NOTE: the class name needs to match what's registered  | 
                                                        |
| 1438 | - * in the EE_Dependency_Map::$_class_loaders array,  | 
                                                        |
| 1439 | - * including the class prefix, ie: "EE_", "EEM_", "EEH_", etc  | 
                                                        |
| 1440 | - * @param array $arguments  | 
                                                        |
| 1441 | - * @return object  | 
                                                        |
| 1442 | - */  | 
                                                        |
| 1443 | - public static function factory($classname, $arguments = array())  | 
                                                        |
| 1444 | -    { | 
                                                        |
| 1445 | - $loader = self::instance()->_dependency_map->class_loader($classname);  | 
                                                        |
| 1446 | -        if ($loader instanceof Closure) { | 
                                                        |
| 1447 | - return $loader($arguments);  | 
                                                        |
| 1448 | - }  | 
                                                        |
| 1449 | -        if (method_exists(self::instance(), $loader)) { | 
                                                        |
| 1450 | -            return self::instance()->{$loader}($classname, $arguments); | 
                                                        |
| 1451 | - }  | 
                                                        |
| 1452 | - return null;  | 
                                                        |
| 1453 | - }  | 
                                                        |
| 1454 | -  | 
                                                        |
| 1455 | -  | 
                                                        |
| 1456 | - /**  | 
                                                        |
| 1457 | - * Gets the addon by its class name  | 
                                                        |
| 1458 | - *  | 
                                                        |
| 1459 | - * @param string $class_name  | 
                                                        |
| 1460 | - * @return EE_Addon  | 
                                                        |
| 1461 | - */  | 
                                                        |
| 1462 | - public function getAddon($class_name)  | 
                                                        |
| 1463 | -    { | 
                                                        |
| 1464 | -        $class_name = str_replace('\\', '_', $class_name); | 
                                                        |
| 1465 | -        return $this->addons->{$class_name}; | 
                                                        |
| 1466 | - }  | 
                                                        |
| 1467 | -  | 
                                                        |
| 1468 | -  | 
                                                        |
| 1469 | - /**  | 
                                                        |
| 1470 | - * removes the addon from the internal cache  | 
                                                        |
| 1471 | - *  | 
                                                        |
| 1472 | - * @param string $class_name  | 
                                                        |
| 1473 | - * @return void  | 
                                                        |
| 1474 | - */  | 
                                                        |
| 1475 | - public function removeAddon($class_name)  | 
                                                        |
| 1476 | -    { | 
                                                        |
| 1477 | -        $class_name = str_replace('\\', '_', $class_name); | 
                                                        |
| 1478 | -        unset($this->addons->{$class_name}); | 
                                                        |
| 1479 | - }  | 
                                                        |
| 1480 | -  | 
                                                        |
| 1481 | -  | 
                                                        |
| 1482 | - /**  | 
                                                        |
| 1483 | - * Gets the addon by its name/slug (not classname. For that, just  | 
                                                        |
| 1484 | - * use the get_addon() method above  | 
                                                        |
| 1485 | - *  | 
                                                        |
| 1486 | - * @param string $name  | 
                                                        |
| 1487 | - * @return EE_Addon  | 
                                                        |
| 1488 | - */  | 
                                                        |
| 1489 | - public function get_addon_by_name($name)  | 
                                                        |
| 1490 | -    { | 
                                                        |
| 1491 | -        foreach ($this->addons as $addon) { | 
                                                        |
| 1492 | -            if ($addon->name() === $name) { | 
                                                        |
| 1493 | - return $addon;  | 
                                                        |
| 1494 | - }  | 
                                                        |
| 1495 | - }  | 
                                                        |
| 1496 | - return null;  | 
                                                        |
| 1497 | - }  | 
                                                        |
| 1498 | -  | 
                                                        |
| 1499 | -  | 
                                                        |
| 1500 | - /**  | 
                                                        |
| 1501 | - * Gets an array of all the registered addons, where the keys are their names.  | 
                                                        |
| 1502 | - * (ie, what each returns for their name() function)  | 
                                                        |
| 1503 | - * They're already available on EE_Registry::instance()->addons as properties,  | 
                                                        |
| 1504 | - * where each property's name is the addon's classname,  | 
                                                        |
| 1505 | - * So if you just want to get the addon by classname,  | 
                                                        |
| 1506 | - * OR use the get_addon() method above.  | 
                                                        |
| 1507 | - * PLEASE NOTE:  | 
                                                        |
| 1508 | - * addons with Fully Qualified Class Names  | 
                                                        |
| 1509 | - * have had the namespace separators converted to underscores,  | 
                                                        |
| 1510 | - * so a classname like Fully\Qualified\ClassName  | 
                                                        |
| 1511 | - * would have been converted to Fully_Qualified_ClassName  | 
                                                        |
| 1512 | - *  | 
                                                        |
| 1513 | - * @return EE_Addon[] where the KEYS are the addon's name()  | 
                                                        |
| 1514 | - */  | 
                                                        |
| 1515 | - public function get_addons_by_name()  | 
                                                        |
| 1516 | -    { | 
                                                        |
| 1517 | - $addons = array();  | 
                                                        |
| 1518 | -        foreach ($this->addons as $addon) { | 
                                                        |
| 1519 | - $addons[ $addon->name() ] = $addon;  | 
                                                        |
| 1520 | - }  | 
                                                        |
| 1521 | - return $addons;  | 
                                                        |
| 1522 | - }  | 
                                                        |
| 1523 | -  | 
                                                        |
| 1524 | -  | 
                                                        |
| 1525 | - /**  | 
                                                        |
| 1526 | - * Resets the specified model's instance AND makes sure EE_Registry doesn't keep  | 
                                                        |
| 1527 | - * a stale copy of it around  | 
                                                        |
| 1528 | - *  | 
                                                        |
| 1529 | - * @param string $model_name  | 
                                                        |
| 1530 | - * @return \EEM_Base  | 
                                                        |
| 1531 | - * @throws \EE_Error  | 
                                                        |
| 1532 | - */  | 
                                                        |
| 1533 | - public function reset_model($model_name)  | 
                                                        |
| 1534 | -    { | 
                                                        |
| 1535 | - $model_class_name = strpos($model_name, 'EEM_') !== 0  | 
                                                        |
| 1536 | -            ? "EEM_{$model_name}" | 
                                                        |
| 1537 | - : $model_name;  | 
                                                        |
| 1538 | -        if (! isset($this->LIB->{$model_class_name}) || ! $this->LIB->{$model_class_name} instanceof EEM_Base) { | 
                                                        |
| 1539 | - return null;  | 
                                                        |
| 1540 | - }  | 
                                                        |
| 1541 | - //get that model reset it and make sure we nuke the old reference to it  | 
                                                        |
| 1542 | -        if ($this->LIB->{$model_class_name} instanceof $model_class_name | 
                                                        |
| 1543 | - && is_callable(  | 
                                                        |
| 1544 | - array($model_class_name, 'reset')  | 
                                                        |
| 1545 | -            )) { | 
                                                        |
| 1546 | -            $this->LIB->{$model_class_name} = $this->LIB->{$model_class_name}->reset(); | 
                                                        |
| 1547 | -        } else { | 
                                                        |
| 1548 | - throw new EE_Error(  | 
                                                        |
| 1549 | - sprintf(  | 
                                                        |
| 1550 | -                    esc_html__('Model %s does not have a method "reset"', 'event_espresso'), | 
                                                        |
| 1551 | - $model_name  | 
                                                        |
| 1552 | - )  | 
                                                        |
| 1553 | - );  | 
                                                        |
| 1554 | - }  | 
                                                        |
| 1555 | -        return $this->LIB->{$model_class_name}; | 
                                                        |
| 1556 | - }  | 
                                                        |
| 1557 | -  | 
                                                        |
| 1558 | -  | 
                                                        |
| 1559 | - /**  | 
                                                        |
| 1560 | - * Resets the registry.  | 
                                                        |
| 1561 | - * The criteria for what gets reset is based on what can be shared between sites on the same request when  | 
                                                        |
| 1562 | - * switch_to_blog is used in a multisite install. Here is a list of things that are NOT reset.  | 
                                                        |
| 1563 | - * - $_dependency_map  | 
                                                        |
| 1564 | - * - $_class_abbreviations  | 
                                                        |
| 1565 | - * - $NET_CFG (EE_Network_Config): The config is shared network wide so no need to reset.  | 
                                                        |
| 1566 | - * - $REQ: Still on the same request so no need to change.  | 
                                                        |
| 1567 | - * - $CAP: There is no site specific state in the EE_Capability class.  | 
                                                        |
| 1568 | - * - $SSN: Although ideally, the session should not be shared between site switches, we can't reset it because only  | 
                                                        |
| 1569 | - * one Session can be active in a single request. Resetting could resolve in "headers already sent" errors.  | 
                                                        |
| 1570 | - * - $addons: In multisite, the state of the addons is something controlled via hooks etc in a normal request. So  | 
                                                        |
| 1571 | - * for now, we won't reset the addons because it could break calls to an add-ons class/methods in the  | 
                                                        |
| 1572 | - * switch or on the restore.  | 
                                                        |
| 1573 | - * - $modules  | 
                                                        |
| 1574 | - * - $shortcodes  | 
                                                        |
| 1575 | - * - $widgets  | 
                                                        |
| 1576 | - *  | 
                                                        |
| 1577 | - * @param boolean $hard [deprecated]  | 
                                                        |
| 1578 | - * @param boolean $reinstantiate whether to create new instances of EE_Registry's singletons too,  | 
                                                        |
| 1579 | - * or just reset without re-instantiating (handy to set to FALSE if you're not  | 
                                                        |
| 1580 | - * sure if you CAN currently reinstantiate the singletons at the moment)  | 
                                                        |
| 1581 | - * @param bool $reset_models Defaults to true. When false, then the models are not reset. This is so  | 
                                                        |
| 1582 | - * client  | 
                                                        |
| 1583 | - * code instead can just change the model context to a different blog id if  | 
                                                        |
| 1584 | - * necessary  | 
                                                        |
| 1585 | - * @return EE_Registry  | 
                                                        |
| 1586 | - * @throws InvalidInterfaceException  | 
                                                        |
| 1587 | - * @throws InvalidDataTypeException  | 
                                                        |
| 1588 | - * @throws EE_Error  | 
                                                        |
| 1589 | - * @throws ReflectionException  | 
                                                        |
| 1590 | - * @throws InvalidArgumentException  | 
                                                        |
| 1591 | - */  | 
                                                        |
| 1592 | - public static function reset($hard = false, $reinstantiate = true, $reset_models = true)  | 
                                                        |
| 1593 | -    { | 
                                                        |
| 1594 | - $instance = self::instance();  | 
                                                        |
| 1595 | - $instance->_cache_on = true;  | 
                                                        |
| 1596 | - // reset some "special" classes  | 
                                                        |
| 1597 | - EEH_Activation::reset();  | 
                                                        |
| 1598 | -        $hard                     = apply_filters('FHEE__EE_Registry__reset__hard', $hard); | 
                                                        |
| 1599 | - $instance->CFG = EE_Config::reset($hard, $reinstantiate);  | 
                                                        |
| 1600 | - $instance->CART = null;  | 
                                                        |
| 1601 | - $instance->MRM = null;  | 
                                                        |
| 1602 | -        $instance->AssetsRegistry = $instance->create('EventEspresso\core\services\assets\Registry'); | 
                                                        |
| 1603 | - //messages reset  | 
                                                        |
| 1604 | - EED_Messages::reset();  | 
                                                        |
| 1605 | - //handle of objects cached on LIB  | 
                                                        |
| 1606 | -        foreach (array('LIB', 'modules') as $cache) { | 
                                                        |
| 1607 | -            foreach ($instance->{$cache} as $class_name => $class) { | 
                                                        |
| 1608 | -                if (self::_reset_and_unset_object($class, $reset_models)) { | 
                                                        |
| 1609 | -                    unset($instance->{$cache}->{$class_name}); | 
                                                        |
| 1610 | - }  | 
                                                        |
| 1611 | - }  | 
                                                        |
| 1612 | - }  | 
                                                        |
| 1613 | - return $instance;  | 
                                                        |
| 1614 | - }  | 
                                                        |
| 1615 | -  | 
                                                        |
| 1616 | -  | 
                                                        |
| 1617 | - /**  | 
                                                        |
| 1618 | - * if passed object implements ResettableInterface, then call it's reset() method  | 
                                                        |
| 1619 | - * if passed object implements InterminableInterface, then return false,  | 
                                                        |
| 1620 | - * to indicate that it should NOT be cleared from the Registry cache  | 
                                                        |
| 1621 | - *  | 
                                                        |
| 1622 | - * @param $object  | 
                                                        |
| 1623 | - * @param bool $reset_models  | 
                                                        |
| 1624 | - * @return bool returns true if cached object should be unset  | 
                                                        |
| 1625 | - */  | 
                                                        |
| 1626 | - private static function _reset_and_unset_object($object, $reset_models)  | 
                                                        |
| 1627 | -    { | 
                                                        |
| 1628 | -        if (! is_object($object)) { | 
                                                        |
| 1629 | - // don't unset anything that's not an object  | 
                                                        |
| 1630 | - return false;  | 
                                                        |
| 1631 | - }  | 
                                                        |
| 1632 | -        if ($object instanceof EED_Module) { | 
                                                        |
| 1633 | - $object::reset();  | 
                                                        |
| 1634 | - // don't unset modules  | 
                                                        |
| 1635 | - return false;  | 
                                                        |
| 1636 | - }  | 
                                                        |
| 1637 | -        if ($object instanceof ResettableInterface) { | 
                                                        |
| 1638 | -            if ($object instanceof EEM_Base) { | 
                                                        |
| 1639 | -                if ($reset_models) { | 
                                                        |
| 1640 | - $object->reset();  | 
                                                        |
| 1641 | - return true;  | 
                                                        |
| 1642 | - }  | 
                                                        |
| 1643 | - return false;  | 
                                                        |
| 1644 | - }  | 
                                                        |
| 1645 | - $object->reset();  | 
                                                        |
| 1646 | - return true;  | 
                                                        |
| 1647 | - }  | 
                                                        |
| 1648 | -        if (! $object instanceof InterminableInterface) { | 
                                                        |
| 1649 | - return true;  | 
                                                        |
| 1650 | - }  | 
                                                        |
| 1651 | - return false;  | 
                                                        |
| 1652 | - }  | 
                                                        |
| 1653 | -  | 
                                                        |
| 1654 | -  | 
                                                        |
| 1655 | - /**  | 
                                                        |
| 1656 | - * Gets all the custom post type models defined  | 
                                                        |
| 1657 | - *  | 
                                                        |
| 1658 | - * @return array keys are model "short names" (Eg "Event") and keys are classnames (eg "EEM_Event")  | 
                                                        |
| 1659 | - */  | 
                                                        |
| 1660 | - public function cpt_models()  | 
                                                        |
| 1661 | -    { | 
                                                        |
| 1662 | - $cpt_models = array();  | 
                                                        |
| 1663 | -        foreach ($this->non_abstract_db_models as $short_name => $classname) { | 
                                                        |
| 1664 | -            if (is_subclass_of($classname, 'EEM_CPT_Base')) { | 
                                                        |
| 1665 | - $cpt_models[ $short_name ] = $classname;  | 
                                                        |
| 1666 | - }  | 
                                                        |
| 1667 | - }  | 
                                                        |
| 1668 | - return $cpt_models;  | 
                                                        |
| 1669 | - }  | 
                                                        |
| 1670 | -  | 
                                                        |
| 1671 | -  | 
                                                        |
| 1672 | - /**  | 
                                                        |
| 1673 | - * @return \EE_Config  | 
                                                        |
| 1674 | - */  | 
                                                        |
| 1675 | - public static function CFG()  | 
                                                        |
| 1676 | -    { | 
                                                        |
| 1677 | - return self::instance()->CFG;  | 
                                                        |
| 1678 | - }  | 
                                                        |
| 1679 | -  | 
                                                        |
| 1680 | -  | 
                                                        |
| 1681 | - /**  | 
                                                        |
| 1682 | - * @deprecated $VID:$  | 
                                                        |
| 1683 | - * @param string $class_name  | 
                                                        |
| 1684 | - * @return ReflectionClass  | 
                                                        |
| 1685 | - * @throws ReflectionException  | 
                                                        |
| 1686 | - * @throws InvalidDataTypeException  | 
                                                        |
| 1687 | - */  | 
                                                        |
| 1688 | - public function get_ReflectionClass($class_name)  | 
                                                        |
| 1689 | -    { | 
                                                        |
| 1690 | - return $this->mirror->getReflectionClass($class_name);  | 
                                                        |
| 1691 | - }  | 
                                                        |
| 30 | + /**  | 
                                                        |
| 31 | + * @var EE_Registry $_instance  | 
                                                        |
| 32 | + */  | 
                                                        |
| 33 | + private static $_instance;  | 
                                                        |
| 34 | +  | 
                                                        |
| 35 | + /**  | 
                                                        |
| 36 | + * @var EE_Dependency_Map $_dependency_map  | 
                                                        |
| 37 | + */  | 
                                                        |
| 38 | + protected $_dependency_map;  | 
                                                        |
| 39 | +  | 
                                                        |
| 40 | + /**  | 
                                                        |
| 41 | + * @var Mirror  | 
                                                        |
| 42 | + */  | 
                                                        |
| 43 | + private $mirror;  | 
                                                        |
| 44 | +  | 
                                                        |
| 45 | + /**  | 
                                                        |
| 46 | + * @var ClassInterfaceCache $class_cache  | 
                                                        |
| 47 | + */  | 
                                                        |
| 48 | + private $class_cache;  | 
                                                        |
| 49 | +  | 
                                                        |
| 50 | + /**  | 
                                                        |
| 51 | + * @var array $_class_abbreviations  | 
                                                        |
| 52 | + */  | 
                                                        |
| 53 | + protected $_class_abbreviations = array();  | 
                                                        |
| 54 | +  | 
                                                        |
| 55 | + /**  | 
                                                        |
| 56 | + * @var CommandBusInterface $BUS  | 
                                                        |
| 57 | + */  | 
                                                        |
| 58 | + public $BUS;  | 
                                                        |
| 59 | +  | 
                                                        |
| 60 | + /**  | 
                                                        |
| 61 | + * @var EE_Cart $CART  | 
                                                        |
| 62 | + */  | 
                                                        |
| 63 | + public $CART;  | 
                                                        |
| 64 | +  | 
                                                        |
| 65 | + /**  | 
                                                        |
| 66 | + * @var EE_Config $CFG  | 
                                                        |
| 67 | + */  | 
                                                        |
| 68 | + public $CFG;  | 
                                                        |
| 69 | +  | 
                                                        |
| 70 | + /**  | 
                                                        |
| 71 | + * @var EE_Network_Config $NET_CFG  | 
                                                        |
| 72 | + */  | 
                                                        |
| 73 | + public $NET_CFG;  | 
                                                        |
| 74 | +  | 
                                                        |
| 75 | + /**  | 
                                                        |
| 76 | + * StdClass object for storing library classes in  | 
                                                        |
| 77 | + *  | 
                                                        |
| 78 | + * @var RegistryContainer $LIB  | 
                                                        |
| 79 | + */  | 
                                                        |
| 80 | + public $LIB;  | 
                                                        |
| 81 | +  | 
                                                        |
| 82 | + /**  | 
                                                        |
| 83 | + * @var EE_Request_Handler $REQ  | 
                                                        |
| 84 | + */  | 
                                                        |
| 85 | + public $REQ;  | 
                                                        |
| 86 | +  | 
                                                        |
| 87 | + /**  | 
                                                        |
| 88 | + * @var EE_Session $SSN  | 
                                                        |
| 89 | + */  | 
                                                        |
| 90 | + public $SSN;  | 
                                                        |
| 91 | +  | 
                                                        |
| 92 | + /**  | 
                                                        |
| 93 | + * @since 4.5.0  | 
                                                        |
| 94 | + * @var EE_Capabilities $CAP  | 
                                                        |
| 95 | + */  | 
                                                        |
| 96 | + public $CAP;  | 
                                                        |
| 97 | +  | 
                                                        |
| 98 | + /**  | 
                                                        |
| 99 | + * @since 4.9.0  | 
                                                        |
| 100 | + * @var EE_Message_Resource_Manager $MRM  | 
                                                        |
| 101 | + */  | 
                                                        |
| 102 | + public $MRM;  | 
                                                        |
| 103 | +  | 
                                                        |
| 104 | + /**  | 
                                                        |
| 105 | + * @var Registry $AssetsRegistry  | 
                                                        |
| 106 | + */  | 
                                                        |
| 107 | + public $AssetsRegistry;  | 
                                                        |
| 108 | +  | 
                                                        |
| 109 | + /**  | 
                                                        |
| 110 | + * StdClass object for holding addons which have registered themselves to work with EE core  | 
                                                        |
| 111 | + *  | 
                                                        |
| 112 | + * @var EE_Addon[] $addons  | 
                                                        |
| 113 | + */  | 
                                                        |
| 114 | + public $addons;  | 
                                                        |
| 115 | +  | 
                                                        |
| 116 | + /**  | 
                                                        |
| 117 | + * keys are 'short names' (eg Event), values are class names (eg 'EEM_Event')  | 
                                                        |
| 118 | + *  | 
                                                        |
| 119 | + * @var EEM_Base[] $models  | 
                                                        |
| 120 | + */  | 
                                                        |
| 121 | + public $models = array();  | 
                                                        |
| 122 | +  | 
                                                        |
| 123 | + /**  | 
                                                        |
| 124 | + * @var EED_Module[] $modules  | 
                                                        |
| 125 | + */  | 
                                                        |
| 126 | + public $modules;  | 
                                                        |
| 127 | +  | 
                                                        |
| 128 | + /**  | 
                                                        |
| 129 | + * @var EES_Shortcode[] $shortcodes  | 
                                                        |
| 130 | + */  | 
                                                        |
| 131 | + public $shortcodes;  | 
                                                        |
| 132 | +  | 
                                                        |
| 133 | + /**  | 
                                                        |
| 134 | + * @var WP_Widget[] $widgets  | 
                                                        |
| 135 | + */  | 
                                                        |
| 136 | + public $widgets;  | 
                                                        |
| 137 | +  | 
                                                        |
| 138 | + /**  | 
                                                        |
| 139 | + * this is an array of all implemented model names (i.e. not the parent abstract models, or models  | 
                                                        |
| 140 | + * which don't actually fetch items from the DB in the normal way (ie, are not children of EEM_Base)).  | 
                                                        |
| 141 | + * Keys are model "short names" (eg "Event") as used in model relations, and values are  | 
                                                        |
| 142 | + * classnames (eg "EEM_Event")  | 
                                                        |
| 143 | + *  | 
                                                        |
| 144 | + * @var array $non_abstract_db_models  | 
                                                        |
| 145 | + */  | 
                                                        |
| 146 | + public $non_abstract_db_models = array();  | 
                                                        |
| 147 | +  | 
                                                        |
| 148 | + /**  | 
                                                        |
| 149 | + * internationalization for JS strings  | 
                                                        |
| 150 | + * usage: EE_Registry::i18n_js_strings['string_key'] = esc_html__( 'string to translate.', 'event_espresso' );  | 
                                                        |
| 151 | + * in js file: var translatedString = eei18n.string_key;  | 
                                                        |
| 152 | + *  | 
                                                        |
| 153 | + * @var array $i18n_js_strings  | 
                                                        |
| 154 | + */  | 
                                                        |
| 155 | + public static $i18n_js_strings = array();  | 
                                                        |
| 156 | +  | 
                                                        |
| 157 | + /**  | 
                                                        |
| 158 | + * $main_file - path to espresso.php  | 
                                                        |
| 159 | + *  | 
                                                        |
| 160 | + * @var array $main_file  | 
                                                        |
| 161 | + */  | 
                                                        |
| 162 | + public $main_file;  | 
                                                        |
| 163 | +  | 
                                                        |
| 164 | + /**  | 
                                                        |
| 165 | + * array of ReflectionClass objects where the key is the class name  | 
                                                        |
| 166 | + *  | 
                                                        |
| 167 | + * @deprecated $VID:$  | 
                                                        |
| 168 | + * @var ReflectionClass[] $_reflectors  | 
                                                        |
| 169 | + */  | 
                                                        |
| 170 | + public $_reflectors;  | 
                                                        |
| 171 | +  | 
                                                        |
| 172 | + /**  | 
                                                        |
| 173 | + * boolean flag to indicate whether or not to load/save dependencies from/to the cache  | 
                                                        |
| 174 | + *  | 
                                                        |
| 175 | + * @var boolean $_cache_on  | 
                                                        |
| 176 | + */  | 
                                                        |
| 177 | + protected $_cache_on = true;  | 
                                                        |
| 178 | +  | 
                                                        |
| 179 | + /**  | 
                                                        |
| 180 | + * @var ObjectIdentifier  | 
                                                        |
| 181 | + */  | 
                                                        |
| 182 | + private $object_identifier;  | 
                                                        |
| 183 | +  | 
                                                        |
| 184 | +  | 
                                                        |
| 185 | + /**  | 
                                                        |
| 186 | + * @singleton method used to instantiate class object  | 
                                                        |
| 187 | + * @param EE_Dependency_Map|null $dependency_map  | 
                                                        |
| 188 | + * @param Mirror|null $mirror  | 
                                                        |
| 189 | + * @param ClassInterfaceCache|null $class_cache  | 
                                                        |
| 190 | + * @param ObjectIdentifier|null $object_identifier  | 
                                                        |
| 191 | + * @return EE_Registry instance  | 
                                                        |
| 192 | + */  | 
                                                        |
| 193 | + public static function instance(  | 
                                                        |
| 194 | + EE_Dependency_Map $dependency_map = null,  | 
                                                        |
| 195 | + Mirror $mirror = null,  | 
                                                        |
| 196 | + ClassInterfaceCache $class_cache = null,  | 
                                                        |
| 197 | + ObjectIdentifier $object_identifier = null  | 
                                                        |
| 198 | +	) { | 
                                                        |
| 199 | + // check if class object is instantiated  | 
                                                        |
| 200 | + if (  | 
                                                        |
| 201 | + ! self::$_instance instanceof EE_Registry  | 
                                                        |
| 202 | + && $dependency_map instanceof EE_Dependency_Map  | 
                                                        |
| 203 | + && $mirror instanceof Mirror  | 
                                                        |
| 204 | + && $class_cache instanceof ClassInterfaceCache  | 
                                                        |
| 205 | + && $object_identifier instanceof ObjectIdentifier  | 
                                                        |
| 206 | +		) { | 
                                                        |
| 207 | + self::$_instance = new self(  | 
                                                        |
| 208 | + $dependency_map,  | 
                                                        |
| 209 | + $mirror,  | 
                                                        |
| 210 | + $class_cache,  | 
                                                        |
| 211 | + $object_identifier  | 
                                                        |
| 212 | + );  | 
                                                        |
| 213 | + }  | 
                                                        |
| 214 | + return self::$_instance;  | 
                                                        |
| 215 | + }  | 
                                                        |
| 216 | +  | 
                                                        |
| 217 | +  | 
                                                        |
| 218 | + /**  | 
                                                        |
| 219 | + * protected constructor to prevent direct creation  | 
                                                        |
| 220 | + *  | 
                                                        |
| 221 | + * @Constructor  | 
                                                        |
| 222 | + * @param EE_Dependency_Map $dependency_map  | 
                                                        |
| 223 | + * @param Mirror $mirror  | 
                                                        |
| 224 | + * @param ClassInterfaceCache $class_cache  | 
                                                        |
| 225 | + * @param ObjectIdentifier $object_identifier  | 
                                                        |
| 226 | + */  | 
                                                        |
| 227 | + protected function __construct(  | 
                                                        |
| 228 | + EE_Dependency_Map $dependency_map,  | 
                                                        |
| 229 | + Mirror $mirror,  | 
                                                        |
| 230 | + ClassInterfaceCache $class_cache,  | 
                                                        |
| 231 | + ObjectIdentifier $object_identifier  | 
                                                        |
| 232 | +	) { | 
                                                        |
| 233 | + $this->_dependency_map = $dependency_map;  | 
                                                        |
| 234 | + $this->mirror = $mirror;  | 
                                                        |
| 235 | + $this->class_cache = $class_cache;  | 
                                                        |
| 236 | + $this->object_identifier = $object_identifier;  | 
                                                        |
| 237 | + // $registry_container = new RegistryContainer();  | 
                                                        |
| 238 | + $this->LIB = new RegistryContainer();  | 
                                                        |
| 239 | + $this->addons = new RegistryContainer();  | 
                                                        |
| 240 | + $this->modules = new RegistryContainer();  | 
                                                        |
| 241 | + $this->shortcodes = new RegistryContainer();  | 
                                                        |
| 242 | + $this->widgets = new RegistryContainer();  | 
                                                        |
| 243 | +		add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize')); | 
                                                        |
| 244 | + }  | 
                                                        |
| 245 | +  | 
                                                        |
| 246 | +  | 
                                                        |
| 247 | + /**  | 
                                                        |
| 248 | + * initialize  | 
                                                        |
| 249 | + *  | 
                                                        |
| 250 | + * @throws OutOfBoundsException  | 
                                                        |
| 251 | + * @throws InvalidArgumentException  | 
                                                        |
| 252 | + * @throws InvalidInterfaceException  | 
                                                        |
| 253 | + * @throws InvalidDataTypeException  | 
                                                        |
| 254 | + * @throws EE_Error  | 
                                                        |
| 255 | + * @throws ReflectionException  | 
                                                        |
| 256 | + */  | 
                                                        |
| 257 | + public function initialize()  | 
                                                        |
| 258 | +	{ | 
                                                        |
| 259 | + $this->_class_abbreviations = apply_filters(  | 
                                                        |
| 260 | + 'FHEE__EE_Registry____construct___class_abbreviations',  | 
                                                        |
| 261 | + array(  | 
                                                        |
| 262 | + 'EE_Config' => 'CFG',  | 
                                                        |
| 263 | + 'EE_Session' => 'SSN',  | 
                                                        |
| 264 | + 'EE_Capabilities' => 'CAP',  | 
                                                        |
| 265 | + 'EE_Cart' => 'CART',  | 
                                                        |
| 266 | + 'EE_Network_Config' => 'NET_CFG',  | 
                                                        |
| 267 | + 'EE_Request_Handler' => 'REQ',  | 
                                                        |
| 268 | + 'EE_Message_Resource_Manager' => 'MRM',  | 
                                                        |
| 269 | + 'EventEspresso\core\services\commands\CommandBus' => 'BUS',  | 
                                                        |
| 270 | + 'EventEspresso\core\services\assets\Registry' => 'AssetsRegistry',  | 
                                                        |
| 271 | + )  | 
                                                        |
| 272 | + );  | 
                                                        |
| 273 | +		$this->load_core('Base', array(), true); | 
                                                        |
| 274 | + // add our request and response objects to the cache  | 
                                                        |
| 275 | + $request_loader = $this->_dependency_map->class_loader(  | 
                                                        |
| 276 | + 'EventEspresso\core\services\request\Request'  | 
                                                        |
| 277 | + );  | 
                                                        |
| 278 | + $this->_set_cached_class(  | 
                                                        |
| 279 | + $request_loader(),  | 
                                                        |
| 280 | + 'EventEspresso\core\services\request\Request'  | 
                                                        |
| 281 | + );  | 
                                                        |
| 282 | + $response_loader = $this->_dependency_map->class_loader(  | 
                                                        |
| 283 | + 'EventEspresso\core\services\request\Response'  | 
                                                        |
| 284 | + );  | 
                                                        |
| 285 | + $this->_set_cached_class(  | 
                                                        |
| 286 | + $response_loader(),  | 
                                                        |
| 287 | + 'EventEspresso\core\services\request\Response'  | 
                                                        |
| 288 | + );  | 
                                                        |
| 289 | +		add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init')); | 
                                                        |
| 290 | + }  | 
                                                        |
| 291 | +  | 
                                                        |
| 292 | +  | 
                                                        |
| 293 | + /**  | 
                                                        |
| 294 | + * @return void  | 
                                                        |
| 295 | + */  | 
                                                        |
| 296 | + public function init()  | 
                                                        |
| 297 | +	{ | 
                                                        |
| 298 | + // Get current page protocol  | 
                                                        |
| 299 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';  | 
                                                        |
| 300 | + // Output admin-ajax.php URL with same protocol as current page  | 
                                                        |
| 301 | +		self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol); | 
                                                        |
| 302 | +		self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : false; | 
                                                        |
| 303 | + }  | 
                                                        |
| 304 | +  | 
                                                        |
| 305 | +  | 
                                                        |
| 306 | + /**  | 
                                                        |
| 307 | + * localize_i18n_js_strings  | 
                                                        |
| 308 | + *  | 
                                                        |
| 309 | + * @return string  | 
                                                        |
| 310 | + */  | 
                                                        |
| 311 | + public static function localize_i18n_js_strings()  | 
                                                        |
| 312 | +	{ | 
                                                        |
| 313 | + $i18n_js_strings = (array) self::$i18n_js_strings;  | 
                                                        |
| 314 | +		foreach ($i18n_js_strings as $key => $value) { | 
                                                        |
| 315 | +			if (is_scalar($value)) { | 
                                                        |
| 316 | + $i18n_js_strings[ $key ] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');  | 
                                                        |
| 317 | + }  | 
                                                        |
| 318 | + }  | 
                                                        |
| 319 | + return '/* <![CDATA[ */ var eei18n = ' . wp_json_encode($i18n_js_strings) . '; /* ]]> */';  | 
                                                        |
| 320 | + }  | 
                                                        |
| 321 | +  | 
                                                        |
| 322 | +  | 
                                                        |
| 323 | + /**  | 
                                                        |
| 324 | + * @param mixed string | EED_Module $module  | 
                                                        |
| 325 | + * @throws OutOfBoundsException  | 
                                                        |
| 326 | + * @throws InvalidArgumentException  | 
                                                        |
| 327 | + * @throws InvalidInterfaceException  | 
                                                        |
| 328 | + * @throws InvalidDataTypeException  | 
                                                        |
| 329 | + * @throws EE_Error  | 
                                                        |
| 330 | + * @throws ReflectionException  | 
                                                        |
| 331 | + */  | 
                                                        |
| 332 | + public function add_module($module)  | 
                                                        |
| 333 | +	{ | 
                                                        |
| 334 | +		if ($module instanceof EED_Module) { | 
                                                        |
| 335 | + $module_class = get_class($module);  | 
                                                        |
| 336 | +			$this->modules->{$module_class} = $module; | 
                                                        |
| 337 | +		} else { | 
                                                        |
| 338 | +			if (! class_exists('EE_Module_Request_Router', false)) { | 
                                                        |
| 339 | +				$this->load_core('Module_Request_Router'); | 
                                                        |
| 340 | + }  | 
                                                        |
| 341 | + EE_Module_Request_Router::module_factory($module);  | 
                                                        |
| 342 | + }  | 
                                                        |
| 343 | + }  | 
                                                        |
| 344 | +  | 
                                                        |
| 345 | +  | 
                                                        |
| 346 | + /**  | 
                                                        |
| 347 | + * @param string $module_name  | 
                                                        |
| 348 | + * @return mixed EED_Module | NULL  | 
                                                        |
| 349 | + */  | 
                                                        |
| 350 | + public function get_module($module_name = '')  | 
                                                        |
| 351 | +	{ | 
                                                        |
| 352 | +		return isset($this->modules->{$module_name}) | 
                                                        |
| 353 | +			? $this->modules->{$module_name} | 
                                                        |
| 354 | + : null;  | 
                                                        |
| 355 | + }  | 
                                                        |
| 356 | +  | 
                                                        |
| 357 | +  | 
                                                        |
| 358 | + /**  | 
                                                        |
| 359 | + * loads core classes - must be singletons  | 
                                                        |
| 360 | + *  | 
                                                        |
| 361 | + * @param string $class_name - simple class name ie: session  | 
                                                        |
| 362 | + * @param mixed $arguments  | 
                                                        |
| 363 | + * @param bool $load_only  | 
                                                        |
| 364 | + * @return mixed  | 
                                                        |
| 365 | + * @throws InvalidInterfaceException  | 
                                                        |
| 366 | + * @throws InvalidDataTypeException  | 
                                                        |
| 367 | + * @throws EE_Error  | 
                                                        |
| 368 | + * @throws ReflectionException  | 
                                                        |
| 369 | + * @throws InvalidArgumentException  | 
                                                        |
| 370 | + */  | 
                                                        |
| 371 | + public function load_core($class_name, $arguments = array(), $load_only = false)  | 
                                                        |
| 372 | +	{ | 
                                                        |
| 373 | + $core_paths = apply_filters(  | 
                                                        |
| 374 | + 'FHEE__EE_Registry__load_core__core_paths',  | 
                                                        |
| 375 | + array(  | 
                                                        |
| 376 | + EE_CORE,  | 
                                                        |
| 377 | + EE_ADMIN,  | 
                                                        |
| 378 | + EE_CPTS,  | 
                                                        |
| 379 | + EE_CORE . 'data_migration_scripts' . DS,  | 
                                                        |
| 380 | + EE_CORE . 'capabilities' . DS,  | 
                                                        |
| 381 | + EE_CORE . 'request_stack' . DS,  | 
                                                        |
| 382 | + EE_CORE . 'middleware' . DS,  | 
                                                        |
| 383 | + )  | 
                                                        |
| 384 | + );  | 
                                                        |
| 385 | + // retrieve instantiated class  | 
                                                        |
| 386 | + return $this->_load(  | 
                                                        |
| 387 | + $core_paths,  | 
                                                        |
| 388 | + 'EE_',  | 
                                                        |
| 389 | + $class_name,  | 
                                                        |
| 390 | + 'core',  | 
                                                        |
| 391 | + $arguments,  | 
                                                        |
| 392 | + false,  | 
                                                        |
| 393 | + true,  | 
                                                        |
| 394 | + $load_only  | 
                                                        |
| 395 | + );  | 
                                                        |
| 396 | + }  | 
                                                        |
| 397 | +  | 
                                                        |
| 398 | +  | 
                                                        |
| 399 | + /**  | 
                                                        |
| 400 | + * loads service classes  | 
                                                        |
| 401 | + *  | 
                                                        |
| 402 | + * @param string $class_name - simple class name ie: session  | 
                                                        |
| 403 | + * @param mixed $arguments  | 
                                                        |
| 404 | + * @param bool $load_only  | 
                                                        |
| 405 | + * @return mixed  | 
                                                        |
| 406 | + * @throws InvalidInterfaceException  | 
                                                        |
| 407 | + * @throws InvalidDataTypeException  | 
                                                        |
| 408 | + * @throws EE_Error  | 
                                                        |
| 409 | + * @throws ReflectionException  | 
                                                        |
| 410 | + * @throws InvalidArgumentException  | 
                                                        |
| 411 | + */  | 
                                                        |
| 412 | + public function load_service($class_name, $arguments = array(), $load_only = false)  | 
                                                        |
| 413 | +	{ | 
                                                        |
| 414 | + $service_paths = apply_filters(  | 
                                                        |
| 415 | + 'FHEE__EE_Registry__load_service__service_paths',  | 
                                                        |
| 416 | + array(  | 
                                                        |
| 417 | + EE_CORE . 'services' . DS,  | 
                                                        |
| 418 | + )  | 
                                                        |
| 419 | + );  | 
                                                        |
| 420 | + // retrieve instantiated class  | 
                                                        |
| 421 | + return $this->_load(  | 
                                                        |
| 422 | + $service_paths,  | 
                                                        |
| 423 | + 'EE_',  | 
                                                        |
| 424 | + $class_name,  | 
                                                        |
| 425 | + 'class',  | 
                                                        |
| 426 | + $arguments,  | 
                                                        |
| 427 | + false,  | 
                                                        |
| 428 | + true,  | 
                                                        |
| 429 | + $load_only  | 
                                                        |
| 430 | + );  | 
                                                        |
| 431 | + }  | 
                                                        |
| 432 | +  | 
                                                        |
| 433 | +  | 
                                                        |
| 434 | + /**  | 
                                                        |
| 435 | + * loads data_migration_scripts  | 
                                                        |
| 436 | + *  | 
                                                        |
| 437 | + * @param string $class_name - class name for the DMS ie: EE_DMS_Core_4_2_0  | 
                                                        |
| 438 | + * @param mixed $arguments  | 
                                                        |
| 439 | + * @return EE_Data_Migration_Script_Base|mixed  | 
                                                        |
| 440 | + * @throws InvalidInterfaceException  | 
                                                        |
| 441 | + * @throws InvalidDataTypeException  | 
                                                        |
| 442 | + * @throws EE_Error  | 
                                                        |
| 443 | + * @throws ReflectionException  | 
                                                        |
| 444 | + * @throws InvalidArgumentException  | 
                                                        |
| 445 | + */  | 
                                                        |
| 446 | + public function load_dms($class_name, $arguments = array())  | 
                                                        |
| 447 | +	{ | 
                                                        |
| 448 | + // retrieve instantiated class  | 
                                                        |
| 449 | + return $this->_load(  | 
                                                        |
| 450 | + EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(),  | 
                                                        |
| 451 | + 'EE_DMS_',  | 
                                                        |
| 452 | + $class_name,  | 
                                                        |
| 453 | + 'dms',  | 
                                                        |
| 454 | + $arguments,  | 
                                                        |
| 455 | + false,  | 
                                                        |
| 456 | + false  | 
                                                        |
| 457 | + );  | 
                                                        |
| 458 | + }  | 
                                                        |
| 459 | +  | 
                                                        |
| 460 | +  | 
                                                        |
| 461 | + /**  | 
                                                        |
| 462 | + * loads object creating classes - must be singletons  | 
                                                        |
| 463 | + *  | 
                                                        |
| 464 | + * @param string $class_name - simple class name ie: attendee  | 
                                                        |
| 465 | + * @param mixed $arguments - an array of arguments to pass to the class  | 
                                                        |
| 466 | + * @param bool $from_db - some classes are instantiated from the db and thus call a different method to  | 
                                                        |
| 467 | + * instantiate  | 
                                                        |
| 468 | + * @param bool $cache if you don't want the class to be stored in the internal cache (non-persistent) then  | 
                                                        |
| 469 | + * set this to FALSE (ie. when instantiating model objects from client in a loop)  | 
                                                        |
| 470 | + * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate  | 
                                                        |
| 471 | + * (default)  | 
                                                        |
| 472 | + * @return EE_Base_Class | bool  | 
                                                        |
| 473 | + * @throws InvalidInterfaceException  | 
                                                        |
| 474 | + * @throws InvalidDataTypeException  | 
                                                        |
| 475 | + * @throws EE_Error  | 
                                                        |
| 476 | + * @throws ReflectionException  | 
                                                        |
| 477 | + * @throws InvalidArgumentException  | 
                                                        |
| 478 | + */  | 
                                                        |
| 479 | + public function load_class($class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false)  | 
                                                        |
| 480 | +	{ | 
                                                        |
| 481 | + $paths = apply_filters(  | 
                                                        |
| 482 | + 'FHEE__EE_Registry__load_class__paths', array(  | 
                                                        |
| 483 | + EE_CORE,  | 
                                                        |
| 484 | + EE_CLASSES,  | 
                                                        |
| 485 | + EE_BUSINESS,  | 
                                                        |
| 486 | + )  | 
                                                        |
| 487 | + );  | 
                                                        |
| 488 | + // retrieve instantiated class  | 
                                                        |
| 489 | + return $this->_load(  | 
                                                        |
| 490 | + $paths,  | 
                                                        |
| 491 | + 'EE_',  | 
                                                        |
| 492 | + $class_name,  | 
                                                        |
| 493 | + 'class',  | 
                                                        |
| 494 | + $arguments,  | 
                                                        |
| 495 | + $from_db,  | 
                                                        |
| 496 | + $cache,  | 
                                                        |
| 497 | + $load_only  | 
                                                        |
| 498 | + );  | 
                                                        |
| 499 | + }  | 
                                                        |
| 500 | +  | 
                                                        |
| 501 | +  | 
                                                        |
| 502 | + /**  | 
                                                        |
| 503 | + * loads helper classes - must be singletons  | 
                                                        |
| 504 | + *  | 
                                                        |
| 505 | + * @param string $class_name - simple class name ie: price  | 
                                                        |
| 506 | + * @param mixed $arguments  | 
                                                        |
| 507 | + * @param bool $load_only  | 
                                                        |
| 508 | + * @return EEH_Base | bool  | 
                                                        |
| 509 | + * @throws InvalidInterfaceException  | 
                                                        |
| 510 | + * @throws InvalidDataTypeException  | 
                                                        |
| 511 | + * @throws EE_Error  | 
                                                        |
| 512 | + * @throws ReflectionException  | 
                                                        |
| 513 | + * @throws InvalidArgumentException  | 
                                                        |
| 514 | + */  | 
                                                        |
| 515 | + public function load_helper($class_name, $arguments = array(), $load_only = true)  | 
                                                        |
| 516 | +	{ | 
                                                        |
| 517 | + // todo: add doing_it_wrong() in a few versions after all addons have had calls to this method removed  | 
                                                        |
| 518 | +		$helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS)); | 
                                                        |
| 519 | + // retrieve instantiated class  | 
                                                        |
| 520 | + return $this->_load(  | 
                                                        |
| 521 | + $helper_paths,  | 
                                                        |
| 522 | + 'EEH_',  | 
                                                        |
| 523 | + $class_name,  | 
                                                        |
| 524 | + 'helper',  | 
                                                        |
| 525 | + $arguments,  | 
                                                        |
| 526 | + false,  | 
                                                        |
| 527 | + true,  | 
                                                        |
| 528 | + $load_only  | 
                                                        |
| 529 | + );  | 
                                                        |
| 530 | + }  | 
                                                        |
| 531 | +  | 
                                                        |
| 532 | +  | 
                                                        |
| 533 | + /**  | 
                                                        |
| 534 | + * loads core classes - must be singletons  | 
                                                        |
| 535 | + *  | 
                                                        |
| 536 | + * @param string $class_name - simple class name ie: session  | 
                                                        |
| 537 | + * @param mixed $arguments  | 
                                                        |
| 538 | + * @param bool $load_only  | 
                                                        |
| 539 | + * @param bool $cache whether to cache the object or not.  | 
                                                        |
| 540 | + * @return mixed  | 
                                                        |
| 541 | + * @throws InvalidInterfaceException  | 
                                                        |
| 542 | + * @throws InvalidDataTypeException  | 
                                                        |
| 543 | + * @throws EE_Error  | 
                                                        |
| 544 | + * @throws ReflectionException  | 
                                                        |
| 545 | + * @throws InvalidArgumentException  | 
                                                        |
| 546 | + */  | 
                                                        |
| 547 | + public function load_lib($class_name, $arguments = array(), $load_only = false, $cache = true)  | 
                                                        |
| 548 | +	{ | 
                                                        |
| 549 | + $paths = array(  | 
                                                        |
| 550 | + EE_LIBRARIES,  | 
                                                        |
| 551 | + EE_LIBRARIES . 'messages' . DS,  | 
                                                        |
| 552 | + EE_LIBRARIES . 'shortcodes' . DS,  | 
                                                        |
| 553 | + EE_LIBRARIES . 'qtips' . DS,  | 
                                                        |
| 554 | + EE_LIBRARIES . 'payment_methods' . DS,  | 
                                                        |
| 555 | + );  | 
                                                        |
| 556 | + // retrieve instantiated class  | 
                                                        |
| 557 | + return $this->_load(  | 
                                                        |
| 558 | + $paths,  | 
                                                        |
| 559 | + 'EE_',  | 
                                                        |
| 560 | + $class_name,  | 
                                                        |
| 561 | + 'lib',  | 
                                                        |
| 562 | + $arguments,  | 
                                                        |
| 563 | + false,  | 
                                                        |
| 564 | + $cache,  | 
                                                        |
| 565 | + $load_only  | 
                                                        |
| 566 | + );  | 
                                                        |
| 567 | + }  | 
                                                        |
| 568 | +  | 
                                                        |
| 569 | +  | 
                                                        |
| 570 | + /**  | 
                                                        |
| 571 | + * loads model classes - must be singletons  | 
                                                        |
| 572 | + *  | 
                                                        |
| 573 | + * @param string $class_name - simple class name ie: price  | 
                                                        |
| 574 | + * @param mixed $arguments  | 
                                                        |
| 575 | + * @param bool $load_only  | 
                                                        |
| 576 | + * @return EEM_Base | bool  | 
                                                        |
| 577 | + * @throws InvalidInterfaceException  | 
                                                        |
| 578 | + * @throws InvalidDataTypeException  | 
                                                        |
| 579 | + * @throws EE_Error  | 
                                                        |
| 580 | + * @throws ReflectionException  | 
                                                        |
| 581 | + * @throws InvalidArgumentException  | 
                                                        |
| 582 | + */  | 
                                                        |
| 583 | + public function load_model($class_name, $arguments = array(), $load_only = false)  | 
                                                        |
| 584 | +	{ | 
                                                        |
| 585 | + $paths = apply_filters(  | 
                                                        |
| 586 | + 'FHEE__EE_Registry__load_model__paths', array(  | 
                                                        |
| 587 | + EE_MODELS,  | 
                                                        |
| 588 | + EE_CORE,  | 
                                                        |
| 589 | + )  | 
                                                        |
| 590 | + );  | 
                                                        |
| 591 | + // retrieve instantiated class  | 
                                                        |
| 592 | + return $this->_load(  | 
                                                        |
| 593 | + $paths,  | 
                                                        |
| 594 | + 'EEM_',  | 
                                                        |
| 595 | + $class_name,  | 
                                                        |
| 596 | + 'model',  | 
                                                        |
| 597 | + $arguments,  | 
                                                        |
| 598 | + false,  | 
                                                        |
| 599 | + true,  | 
                                                        |
| 600 | + $load_only  | 
                                                        |
| 601 | + );  | 
                                                        |
| 602 | + }  | 
                                                        |
| 603 | +  | 
                                                        |
| 604 | +  | 
                                                        |
| 605 | + /**  | 
                                                        |
| 606 | + * loads model classes - must be singletons  | 
                                                        |
| 607 | + *  | 
                                                        |
| 608 | + * @param string $class_name - simple class name ie: price  | 
                                                        |
| 609 | + * @param mixed $arguments  | 
                                                        |
| 610 | + * @param bool $load_only  | 
                                                        |
| 611 | + * @return mixed | bool  | 
                                                        |
| 612 | + * @throws InvalidInterfaceException  | 
                                                        |
| 613 | + * @throws InvalidDataTypeException  | 
                                                        |
| 614 | + * @throws EE_Error  | 
                                                        |
| 615 | + * @throws ReflectionException  | 
                                                        |
| 616 | + * @throws InvalidArgumentException  | 
                                                        |
| 617 | + */  | 
                                                        |
| 618 | + public function load_model_class($class_name, $arguments = array(), $load_only = true)  | 
                                                        |
| 619 | +	{ | 
                                                        |
| 620 | + $paths = array(  | 
                                                        |
| 621 | + EE_MODELS . 'fields' . DS,  | 
                                                        |
| 622 | + EE_MODELS . 'helpers' . DS,  | 
                                                        |
| 623 | + EE_MODELS . 'relations' . DS,  | 
                                                        |
| 624 | + EE_MODELS . 'strategies' . DS,  | 
                                                        |
| 625 | + );  | 
                                                        |
| 626 | + // retrieve instantiated class  | 
                                                        |
| 627 | + return $this->_load(  | 
                                                        |
| 628 | + $paths,  | 
                                                        |
| 629 | + 'EE_',  | 
                                                        |
| 630 | + $class_name,  | 
                                                        |
| 631 | + '',  | 
                                                        |
| 632 | + $arguments,  | 
                                                        |
| 633 | + false,  | 
                                                        |
| 634 | + true,  | 
                                                        |
| 635 | + $load_only  | 
                                                        |
| 636 | + );  | 
                                                        |
| 637 | + }  | 
                                                        |
| 638 | +  | 
                                                        |
| 639 | +  | 
                                                        |
| 640 | + /**  | 
                                                        |
| 641 | + * Determines if $model_name is the name of an actual EE model.  | 
                                                        |
| 642 | + *  | 
                                                        |
| 643 | + * @param string $model_name like Event, Attendee, Question_Group_Question, etc.  | 
                                                        |
| 644 | + * @return boolean  | 
                                                        |
| 645 | + */  | 
                                                        |
| 646 | + public function is_model_name($model_name)  | 
                                                        |
| 647 | +	{ | 
                                                        |
| 648 | + return isset($this->models[ $model_name ]);  | 
                                                        |
| 649 | + }  | 
                                                        |
| 650 | +  | 
                                                        |
| 651 | +  | 
                                                        |
| 652 | + /**  | 
                                                        |
| 653 | + * generic class loader  | 
                                                        |
| 654 | + *  | 
                                                        |
| 655 | + * @param string $path_to_file - directory path to file location, not including filename  | 
                                                        |
| 656 | + * @param string $file_name - file name ie: my_file.php, including extension  | 
                                                        |
| 657 | + * @param string $type - file type - core? class? helper? model?  | 
                                                        |
| 658 | + * @param mixed $arguments  | 
                                                        |
| 659 | + * @param bool $load_only  | 
                                                        |
| 660 | + * @return mixed  | 
                                                        |
| 661 | + * @throws InvalidInterfaceException  | 
                                                        |
| 662 | + * @throws InvalidDataTypeException  | 
                                                        |
| 663 | + * @throws EE_Error  | 
                                                        |
| 664 | + * @throws ReflectionException  | 
                                                        |
| 665 | + * @throws InvalidArgumentException  | 
                                                        |
| 666 | + */  | 
                                                        |
| 667 | + public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true)  | 
                                                        |
| 668 | +	{ | 
                                                        |
| 669 | + // retrieve instantiated class  | 
                                                        |
| 670 | + return $this->_load(  | 
                                                        |
| 671 | + $path_to_file,  | 
                                                        |
| 672 | + '',  | 
                                                        |
| 673 | + $file_name,  | 
                                                        |
| 674 | + $type,  | 
                                                        |
| 675 | + $arguments,  | 
                                                        |
| 676 | + false,  | 
                                                        |
| 677 | + true,  | 
                                                        |
| 678 | + $load_only  | 
                                                        |
| 679 | + );  | 
                                                        |
| 680 | + }  | 
                                                        |
| 681 | +  | 
                                                        |
| 682 | +  | 
                                                        |
| 683 | + /**  | 
                                                        |
| 684 | + * @param string $path_to_file - directory path to file location, not including filename  | 
                                                        |
| 685 | + * @param string $class_name - full class name ie: My_Class  | 
                                                        |
| 686 | + * @param string $type - file type - core? class? helper? model?  | 
                                                        |
| 687 | + * @param mixed $arguments  | 
                                                        |
| 688 | + * @param bool $load_only  | 
                                                        |
| 689 | + * @return bool|EE_Addon|object  | 
                                                        |
| 690 | + * @throws InvalidInterfaceException  | 
                                                        |
| 691 | + * @throws InvalidDataTypeException  | 
                                                        |
| 692 | + * @throws EE_Error  | 
                                                        |
| 693 | + * @throws ReflectionException  | 
                                                        |
| 694 | + * @throws InvalidArgumentException  | 
                                                        |
| 695 | + */  | 
                                                        |
| 696 | + public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false)  | 
                                                        |
| 697 | +	{ | 
                                                        |
| 698 | + // retrieve instantiated class  | 
                                                        |
| 699 | + return $this->_load(  | 
                                                        |
| 700 | + $path_to_file,  | 
                                                        |
| 701 | + 'addon',  | 
                                                        |
| 702 | + $class_name,  | 
                                                        |
| 703 | + $type,  | 
                                                        |
| 704 | + $arguments,  | 
                                                        |
| 705 | + false,  | 
                                                        |
| 706 | + true,  | 
                                                        |
| 707 | + $load_only  | 
                                                        |
| 708 | + );  | 
                                                        |
| 709 | + }  | 
                                                        |
| 710 | +  | 
                                                        |
| 711 | +  | 
                                                        |
| 712 | + /**  | 
                                                        |
| 713 | + * instantiates, caches, and automatically resolves dependencies  | 
                                                        |
| 714 | + * for classes that use a Fully Qualified Class Name.  | 
                                                        |
| 715 | + * if the class is not capable of being loaded using PSR-4 autoloading,  | 
                                                        |
| 716 | + * then you need to use one of the existing load_*() methods  | 
                                                        |
| 717 | + * which can resolve the classname and filepath from the passed arguments  | 
                                                        |
| 718 | + *  | 
                                                        |
| 719 | + * @param bool|string $class_name Fully Qualified Class Name  | 
                                                        |
| 720 | + * @param array $arguments an argument, or array of arguments to pass to the class upon instantiation  | 
                                                        |
| 721 | + * @param bool $cache whether to cache the instantiated object for reuse  | 
                                                        |
| 722 | + * @param bool $from_db some classes are instantiated from the db  | 
                                                        |
| 723 | + * and thus call a different method to instantiate  | 
                                                        |
| 724 | + * @param bool $load_only if true, will only load the file, but will NOT instantiate an object  | 
                                                        |
| 725 | + * @param bool|string $addon if true, will cache the object in the EE_Registry->$addons array  | 
                                                        |
| 726 | + * @return bool|null|mixed null = failure to load or instantiate class object.  | 
                                                        |
| 727 | + * object = class loaded and instantiated successfully.  | 
                                                        |
| 728 | + * bool = fail or success when $load_only is true  | 
                                                        |
| 729 | + * @throws InvalidInterfaceException  | 
                                                        |
| 730 | + * @throws InvalidDataTypeException  | 
                                                        |
| 731 | + * @throws EE_Error  | 
                                                        |
| 732 | + * @throws ReflectionException  | 
                                                        |
| 733 | + * @throws InvalidArgumentException  | 
                                                        |
| 734 | + */  | 
                                                        |
| 735 | + public function create(  | 
                                                        |
| 736 | + $class_name = false,  | 
                                                        |
| 737 | + $arguments = array(),  | 
                                                        |
| 738 | + $cache = false,  | 
                                                        |
| 739 | + $from_db = false,  | 
                                                        |
| 740 | + $load_only = false,  | 
                                                        |
| 741 | + $addon = false  | 
                                                        |
| 742 | +	) { | 
                                                        |
| 743 | + $class_name = ltrim($class_name, '\\');  | 
                                                        |
| 744 | + $class_name = $this->class_cache->getFqnForAlias($class_name);  | 
                                                        |
| 745 | + $class_exists = $this->loadOrVerifyClassExists($class_name, $arguments);  | 
                                                        |
| 746 | + // if a non-FQCN was passed, then  | 
                                                        |
| 747 | + // verifyClassExists() might return an object  | 
                                                        |
| 748 | + // or it could return null if the class just could not be found anywhere  | 
                                                        |
| 749 | +		if ($class_exists instanceof $class_name || $class_exists === null) { | 
                                                        |
| 750 | + // either way, return the results  | 
                                                        |
| 751 | + return $class_exists;  | 
                                                        |
| 752 | + }  | 
                                                        |
| 753 | + $class_name = $class_exists;  | 
                                                        |
| 754 | + // if we're only loading the class and it already exists, then let's just return true immediately  | 
                                                        |
| 755 | +		if ($load_only) { | 
                                                        |
| 756 | + return true;  | 
                                                        |
| 757 | + }  | 
                                                        |
| 758 | + $addon = $addon ? 'addon' : '';  | 
                                                        |
| 759 | + // $this->_cache_on is toggled during the recursive loading that can occur with dependency injection  | 
                                                        |
| 760 | + // $cache is controlled by individual calls to separate Registry loader methods like load_class()  | 
                                                        |
| 761 | + // $load_only is also controlled by individual calls to separate Registry loader methods like load_file()  | 
                                                        |
| 762 | +		if ($this->_cache_on && $cache && ! $load_only) { | 
                                                        |
| 763 | + // return object if it's already cached  | 
                                                        |
| 764 | + $cached_class = $this->_get_cached_class($class_name, $addon, $arguments);  | 
                                                        |
| 765 | +			if ($cached_class !== null) { | 
                                                        |
| 766 | + return $cached_class;  | 
                                                        |
| 767 | + }  | 
                                                        |
| 768 | + }// obtain the loader method from the dependency map  | 
                                                        |
| 769 | + $loader = $this->_dependency_map->class_loader($class_name);// instantiate the requested object  | 
                                                        |
| 770 | +		if ($loader instanceof Closure) { | 
                                                        |
| 771 | + $class_obj = $loader($arguments);  | 
                                                        |
| 772 | +		} else { | 
                                                        |
| 773 | +			if ($loader && method_exists($this, $loader)) { | 
                                                        |
| 774 | +				$class_obj = $this->{$loader}($class_name, $arguments); | 
                                                        |
| 775 | +			} else { | 
                                                        |
| 776 | + $class_obj = $this->_create_object($class_name, $arguments, $addon, $from_db);  | 
                                                        |
| 777 | + }  | 
                                                        |
| 778 | + }  | 
                                                        |
| 779 | +		if (($this->_cache_on && $cache) || $this->get_class_abbreviation($class_name, '')) { | 
                                                        |
| 780 | +			// save it for later... kinda like gum  { : $ | 
                                                        |
| 781 | + $this->_set_cached_class(  | 
                                                        |
| 782 | + $class_obj,  | 
                                                        |
| 783 | + $class_name,  | 
                                                        |
| 784 | + $addon,  | 
                                                        |
| 785 | + $from_db,  | 
                                                        |
| 786 | + $arguments  | 
                                                        |
| 787 | + );  | 
                                                        |
| 788 | + }  | 
                                                        |
| 789 | + $this->_cache_on = true;  | 
                                                        |
| 790 | + return $class_obj;  | 
                                                        |
| 791 | + }  | 
                                                        |
| 792 | +  | 
                                                        |
| 793 | +  | 
                                                        |
| 794 | + /**  | 
                                                        |
| 795 | + * Recursively checks that a class exists and potentially attempts to load classes with non-FQCNs  | 
                                                        |
| 796 | + *  | 
                                                        |
| 797 | + * @param string|object $class_name  | 
                                                        |
| 798 | + * @param array $arguments  | 
                                                        |
| 799 | + * @param int $attempt  | 
                                                        |
| 800 | + * @return mixed  | 
                                                        |
| 801 | + */  | 
                                                        |
| 802 | + private function loadOrVerifyClassExists($class_name, array $arguments, $attempt = 1)  | 
                                                        |
| 803 | +	{ | 
                                                        |
| 804 | +		if (is_object($class_name) || class_exists($class_name)) { | 
                                                        |
| 805 | + return $class_name;  | 
                                                        |
| 806 | + }  | 
                                                        |
| 807 | +		switch ($attempt) { | 
                                                        |
| 808 | + case 1:  | 
                                                        |
| 809 | + // if it's a FQCN then maybe the class is registered with a preceding \  | 
                                                        |
| 810 | + $class_name = strpos($class_name, '\\') !== false  | 
                                                        |
| 811 | + ? '\\' . ltrim($class_name, '\\')  | 
                                                        |
| 812 | + : $class_name;  | 
                                                        |
| 813 | + break;  | 
                                                        |
| 814 | + case 2:  | 
                                                        |
| 815 | + //  | 
                                                        |
| 816 | + $loader = $this->_dependency_map->class_loader($class_name);  | 
                                                        |
| 817 | +				if ($loader && method_exists($this, $loader)) { | 
                                                        |
| 818 | +					return $this->{$loader}($class_name, $arguments); | 
                                                        |
| 819 | + }  | 
                                                        |
| 820 | + break;  | 
                                                        |
| 821 | + case 3:  | 
                                                        |
| 822 | + default;  | 
                                                        |
| 823 | + return null;  | 
                                                        |
| 824 | + }  | 
                                                        |
| 825 | + $attempt++;  | 
                                                        |
| 826 | + return $this->loadOrVerifyClassExists($class_name, $arguments, $attempt);  | 
                                                        |
| 827 | + }  | 
                                                        |
| 828 | +  | 
                                                        |
| 829 | +  | 
                                                        |
| 830 | + /**  | 
                                                        |
| 831 | + * instantiates, caches, and injects dependencies for classes  | 
                                                        |
| 832 | + *  | 
                                                        |
| 833 | + * @param array $file_paths an array of paths to folders to look in  | 
                                                        |
| 834 | + * @param string $class_prefix EE or EEM or... ???  | 
                                                        |
| 835 | + * @param bool|string $class_name $class name  | 
                                                        |
| 836 | + * @param string $type file type - core? class? helper? model?  | 
                                                        |
| 837 | + * @param mixed $arguments an argument or array of arguments to pass to the class upon instantiation  | 
                                                        |
| 838 | + * @param bool $from_db some classes are instantiated from the db  | 
                                                        |
| 839 | + * and thus call a different method to instantiate  | 
                                                        |
| 840 | + * @param bool $cache whether to cache the instantiated object for reuse  | 
                                                        |
| 841 | + * @param bool $load_only if true, will only load the file, but will NOT instantiate an object  | 
                                                        |
| 842 | + * @return bool|null|object null = failure to load or instantiate class object.  | 
                                                        |
| 843 | + * object = class loaded and instantiated successfully.  | 
                                                        |
| 844 | + * bool = fail or success when $load_only is true  | 
                                                        |
| 845 | + * @throws EE_Error  | 
                                                        |
| 846 | + * @throws ReflectionException  | 
                                                        |
| 847 | + * @throws InvalidInterfaceException  | 
                                                        |
| 848 | + * @throws InvalidDataTypeException  | 
                                                        |
| 849 | + * @throws InvalidArgumentException  | 
                                                        |
| 850 | + */  | 
                                                        |
| 851 | + protected function _load(  | 
                                                        |
| 852 | + $file_paths = array(),  | 
                                                        |
| 853 | + $class_prefix = 'EE_',  | 
                                                        |
| 854 | + $class_name = false,  | 
                                                        |
| 855 | + $type = 'class',  | 
                                                        |
| 856 | + $arguments = array(),  | 
                                                        |
| 857 | + $from_db = false,  | 
                                                        |
| 858 | + $cache = true,  | 
                                                        |
| 859 | + $load_only = false  | 
                                                        |
| 860 | +	) { | 
                                                        |
| 861 | + $class_name = ltrim($class_name, '\\');  | 
                                                        |
| 862 | + // strip php file extension  | 
                                                        |
| 863 | +		$class_name = str_replace('.php', '', trim($class_name)); | 
                                                        |
| 864 | + // does the class have a prefix ?  | 
                                                        |
| 865 | +		if (! empty($class_prefix) && $class_prefix !== 'addon') { | 
                                                        |
| 866 | + // make sure $class_prefix is uppercase  | 
                                                        |
| 867 | + $class_prefix = strtoupper(trim($class_prefix));  | 
                                                        |
| 868 | + // add class prefix ONCE!!!  | 
                                                        |
| 869 | + $class_name = $class_prefix . str_replace($class_prefix, '', $class_name);  | 
                                                        |
| 870 | + }  | 
                                                        |
| 871 | + $class_name = $this->class_cache->getFqnForAlias($class_name);  | 
                                                        |
| 872 | + $class_exists = class_exists($class_name, false);  | 
                                                        |
| 873 | + // if we're only loading the class and it already exists, then let's just return true immediately  | 
                                                        |
| 874 | +		if ($load_only && $class_exists) { | 
                                                        |
| 875 | + return true;  | 
                                                        |
| 876 | + }  | 
                                                        |
| 877 | + $arguments = is_array($arguments) ? $arguments : array($arguments);  | 
                                                        |
| 878 | + // $this->_cache_on is toggled during the recursive loading that can occur with dependency injection  | 
                                                        |
| 879 | + // $cache is controlled by individual calls to separate Registry loader methods like load_class()  | 
                                                        |
| 880 | + // $load_only is also controlled by individual calls to separate Registry loader methods like load_file()  | 
                                                        |
| 881 | +		if ($this->_cache_on && $cache && ! $load_only) { | 
                                                        |
| 882 | + // return object if it's already cached  | 
                                                        |
| 883 | + $cached_class = $this->_get_cached_class($class_name, $class_prefix, $arguments);  | 
                                                        |
| 884 | +			if ($cached_class !== null) { | 
                                                        |
| 885 | + return $cached_class;  | 
                                                        |
| 886 | + }  | 
                                                        |
| 887 | + }  | 
                                                        |
| 888 | + // if the class doesn't already exist.. then we need to try and find the file and load it  | 
                                                        |
| 889 | +		if (! $class_exists) { | 
                                                        |
| 890 | + // get full path to file  | 
                                                        |
| 891 | + $path = $this->_resolve_path($class_name, $type, $file_paths);  | 
                                                        |
| 892 | + // load the file  | 
                                                        |
| 893 | + $loaded = $this->_require_file($path, $class_name, $type, $file_paths);  | 
                                                        |
| 894 | + // if we are only loading a file but NOT instantiating an object  | 
                                                        |
| 895 | + // then return boolean for whether class was loaded or not  | 
                                                        |
| 896 | +			if ($load_only) { | 
                                                        |
| 897 | + return $loaded;  | 
                                                        |
| 898 | + }  | 
                                                        |
| 899 | + // if an object was expected but loading failed, then return nothing  | 
                                                        |
| 900 | +			if (! $loaded) { | 
                                                        |
| 901 | + return null;  | 
                                                        |
| 902 | + }  | 
                                                        |
| 903 | + }  | 
                                                        |
| 904 | + // instantiate the requested object  | 
                                                        |
| 905 | + $class_obj = $this->_create_object($class_name, $arguments, $type, $from_db);  | 
                                                        |
| 906 | +		if ($this->_cache_on && $cache) { | 
                                                        |
| 907 | +			// save it for later... kinda like gum  { : $ | 
                                                        |
| 908 | + $this->_set_cached_class(  | 
                                                        |
| 909 | + $class_obj,  | 
                                                        |
| 910 | + $class_name,  | 
                                                        |
| 911 | + $class_prefix,  | 
                                                        |
| 912 | + $from_db,  | 
                                                        |
| 913 | + $arguments  | 
                                                        |
| 914 | + );  | 
                                                        |
| 915 | + }  | 
                                                        |
| 916 | + $this->_cache_on = true;  | 
                                                        |
| 917 | + return $class_obj;  | 
                                                        |
| 918 | + }  | 
                                                        |
| 919 | +  | 
                                                        |
| 920 | +  | 
                                                        |
| 921 | + /**  | 
                                                        |
| 922 | + * @param string $class_name  | 
                                                        |
| 923 | + * @param string $default have to specify something, but not anything that will conflict  | 
                                                        |
| 924 | + * @return mixed|string  | 
                                                        |
| 925 | + */  | 
                                                        |
| 926 | + protected function get_class_abbreviation($class_name, $default = 'FANCY_BATMAN_PANTS')  | 
                                                        |
| 927 | +	{ | 
                                                        |
| 928 | + return isset($this->_class_abbreviations[ $class_name ])  | 
                                                        |
| 929 | + ? $this->_class_abbreviations[ $class_name ]  | 
                                                        |
| 930 | + : $default;  | 
                                                        |
| 931 | + }  | 
                                                        |
| 932 | +  | 
                                                        |
| 933 | +  | 
                                                        |
| 934 | + /**  | 
                                                        |
| 935 | + * attempts to find a cached version of the requested class  | 
                                                        |
| 936 | + * by looking in the following places:  | 
                                                        |
| 937 | +	 *        $this->{$class_abbreviation}            ie:    $this->CART | 
                                                        |
| 938 | +	 *        $this->{$class_name}                        ie:    $this->Some_Class | 
                                                        |
| 939 | +	 *        $this->LIB->{$class_name}                ie:    $this->LIB->Some_Class | 
                                                        |
| 940 | +	 *        $this->addon->{$class_name}    ie:    $this->addon->Some_Addon_Class | 
                                                        |
| 941 | + *  | 
                                                        |
| 942 | + * @param string $class_name  | 
                                                        |
| 943 | + * @param string $class_prefix  | 
                                                        |
| 944 | + * @param array $arguments  | 
                                                        |
| 945 | + * @return mixed  | 
                                                        |
| 946 | + */  | 
                                                        |
| 947 | + protected function _get_cached_class(  | 
                                                        |
| 948 | + $class_name,  | 
                                                        |
| 949 | + $class_prefix = '',  | 
                                                        |
| 950 | + $arguments = array()  | 
                                                        |
| 951 | +	) { | 
                                                        |
| 952 | +		if ($class_name === 'EE_Registry') { | 
                                                        |
| 953 | + return $this;  | 
                                                        |
| 954 | + }  | 
                                                        |
| 955 | + $class_abbreviation = $this->get_class_abbreviation($class_name);  | 
                                                        |
| 956 | + // check if class has already been loaded, and return it if it has been  | 
                                                        |
| 957 | +		if (isset($this->{$class_abbreviation})) { | 
                                                        |
| 958 | +			return $this->{$class_abbreviation}; | 
                                                        |
| 959 | + }  | 
                                                        |
| 960 | +		$class_name = str_replace('\\', '_', $class_name); | 
                                                        |
| 961 | +		if (isset ($this->{$class_name})) { | 
                                                        |
| 962 | +			return $this->{$class_name}; | 
                                                        |
| 963 | + }  | 
                                                        |
| 964 | +		if ($class_prefix === 'addon' && isset ($this->addons->{$class_name})) { | 
                                                        |
| 965 | +			return $this->addons->{$class_name}; | 
                                                        |
| 966 | + }  | 
                                                        |
| 967 | + $object_identifier = $this->object_identifier->getIdentifier($class_name, $arguments);  | 
                                                        |
| 968 | +		if (isset($this->LIB->{$object_identifier})) { | 
                                                        |
| 969 | +			return $this->LIB->{$object_identifier}; | 
                                                        |
| 970 | + }  | 
                                                        |
| 971 | +		foreach ($this->LIB as $key => $object) { | 
                                                        |
| 972 | + if (  | 
                                                        |
| 973 | + // request does not contain new arguments and therefore no args identifier  | 
                                                        |
| 974 | + ! $this->object_identifier->hasArguments($object_identifier)  | 
                                                        |
| 975 | + // but previously cached class with args was found  | 
                                                        |
| 976 | + && $this->object_identifier->fqcnMatchesObjectIdentifier($class_name, $key)  | 
                                                        |
| 977 | +			) { | 
                                                        |
| 978 | + return $object;  | 
                                                        |
| 979 | + }  | 
                                                        |
| 980 | + }  | 
                                                        |
| 981 | + return null;  | 
                                                        |
| 982 | + }  | 
                                                        |
| 983 | +  | 
                                                        |
| 984 | +  | 
                                                        |
| 985 | + /**  | 
                                                        |
| 986 | + * removes a cached version of the requested class  | 
                                                        |
| 987 | + *  | 
                                                        |
| 988 | + * @param string $class_name  | 
                                                        |
| 989 | + * @param boolean $addon  | 
                                                        |
| 990 | + * @param array $arguments  | 
                                                        |
| 991 | + * @return boolean  | 
                                                        |
| 992 | + */  | 
                                                        |
| 993 | + public function clear_cached_class(  | 
                                                        |
| 994 | + $class_name,  | 
                                                        |
| 995 | + $addon = false,  | 
                                                        |
| 996 | + $arguments = array()  | 
                                                        |
| 997 | +	) { | 
                                                        |
| 998 | + $class_abbreviation = $this->get_class_abbreviation($class_name);  | 
                                                        |
| 999 | + // check if class has already been loaded, and return it if it has been  | 
                                                        |
| 1000 | +		if (isset($this->{$class_abbreviation})) { | 
                                                        |
| 1001 | +			$this->{$class_abbreviation} = null; | 
                                                        |
| 1002 | + return true;  | 
                                                        |
| 1003 | + }  | 
                                                        |
| 1004 | +		$class_name = str_replace('\\', '_', $class_name); | 
                                                        |
| 1005 | +		if (isset($this->{$class_name})) { | 
                                                        |
| 1006 | +			$this->{$class_name} = null; | 
                                                        |
| 1007 | + return true;  | 
                                                        |
| 1008 | + }  | 
                                                        |
| 1009 | +		if ($addon && isset($this->addons->{$class_name})) { | 
                                                        |
| 1010 | +			unset($this->addons->{$class_name}); | 
                                                        |
| 1011 | + return true;  | 
                                                        |
| 1012 | + }  | 
                                                        |
| 1013 | + $class_name = $this->object_identifier->getIdentifier($class_name, $arguments);  | 
                                                        |
| 1014 | +		if (isset($this->LIB->{$class_name})) { | 
                                                        |
| 1015 | +			unset($this->LIB->{$class_name}); | 
                                                        |
| 1016 | + return true;  | 
                                                        |
| 1017 | + }  | 
                                                        |
| 1018 | + return false;  | 
                                                        |
| 1019 | + }  | 
                                                        |
| 1020 | +  | 
                                                        |
| 1021 | +  | 
                                                        |
| 1022 | + /**  | 
                                                        |
| 1023 | + * _set_cached_class  | 
                                                        |
| 1024 | + * attempts to cache the instantiated class locally  | 
                                                        |
| 1025 | + * in one of the following places, in the following order:  | 
                                                        |
| 1026 | +	 *        $this->{class_abbreviation}   ie:    $this->CART | 
                                                        |
| 1027 | +	 *        $this->{$class_name}          ie:    $this->Some_Class | 
                                                        |
| 1028 | +	 *        $this->addon->{$$class_name}    ie:    $this->addon->Some_Addon_Class | 
                                                        |
| 1029 | +	 *        $this->LIB->{$class_name}     ie:    $this->LIB->Some_Class | 
                                                        |
| 1030 | + *  | 
                                                        |
| 1031 | + * @param object $class_obj  | 
                                                        |
| 1032 | + * @param string $class_name  | 
                                                        |
| 1033 | + * @param string $class_prefix  | 
                                                        |
| 1034 | + * @param bool $from_db  | 
                                                        |
| 1035 | + * @param array $arguments  | 
                                                        |
| 1036 | + * @return void  | 
                                                        |
| 1037 | + */  | 
                                                        |
| 1038 | + protected function _set_cached_class(  | 
                                                        |
| 1039 | + $class_obj,  | 
                                                        |
| 1040 | + $class_name,  | 
                                                        |
| 1041 | + $class_prefix = '',  | 
                                                        |
| 1042 | + $from_db = false,  | 
                                                        |
| 1043 | + $arguments = array()  | 
                                                        |
| 1044 | +	) { | 
                                                        |
| 1045 | +		if ($class_name === 'EE_Registry' || empty($class_obj)) { | 
                                                        |
| 1046 | + return;  | 
                                                        |
| 1047 | + }  | 
                                                        |
| 1048 | + // return newly instantiated class  | 
                                                        |
| 1049 | + $class_abbreviation = $this->get_class_abbreviation($class_name, '');  | 
                                                        |
| 1050 | +		if ($class_abbreviation) { | 
                                                        |
| 1051 | +			$this->{$class_abbreviation} = $class_obj; | 
                                                        |
| 1052 | + return;  | 
                                                        |
| 1053 | + }  | 
                                                        |
| 1054 | +		$class_name = str_replace('\\', '_', $class_name); | 
                                                        |
| 1055 | +		if (property_exists($this, $class_name)) { | 
                                                        |
| 1056 | +			$this->{$class_name} = $class_obj; | 
                                                        |
| 1057 | + return;  | 
                                                        |
| 1058 | + }  | 
                                                        |
| 1059 | +		if ($class_prefix === 'addon') { | 
                                                        |
| 1060 | +			$this->addons->{$class_name} = $class_obj; | 
                                                        |
| 1061 | + return;  | 
                                                        |
| 1062 | + }  | 
                                                        |
| 1063 | +		if (! $from_db) { | 
                                                        |
| 1064 | + $class_name = $this->object_identifier->getIdentifier($class_name, $arguments);  | 
                                                        |
| 1065 | +			$this->LIB->{$class_name} = $class_obj; | 
                                                        |
| 1066 | + }  | 
                                                        |
| 1067 | + }  | 
                                                        |
| 1068 | +  | 
                                                        |
| 1069 | +  | 
                                                        |
| 1070 | + /**  | 
                                                        |
| 1071 | + * attempts to find a full valid filepath for the requested class.  | 
                                                        |
| 1072 | +	 * loops thru each of the base paths in the $file_paths array and appends : "{classname} . {file type} . php" | 
                                                        |
| 1073 | + * then returns that path if the target file has been found and is readable  | 
                                                        |
| 1074 | + *  | 
                                                        |
| 1075 | + * @param string $class_name  | 
                                                        |
| 1076 | + * @param string $type  | 
                                                        |
| 1077 | + * @param array $file_paths  | 
                                                        |
| 1078 | + * @return string | bool  | 
                                                        |
| 1079 | + */  | 
                                                        |
| 1080 | + protected function _resolve_path($class_name, $type = '', $file_paths = array())  | 
                                                        |
| 1081 | +	{ | 
                                                        |
| 1082 | + // make sure $file_paths is an array  | 
                                                        |
| 1083 | + $file_paths = is_array($file_paths)  | 
                                                        |
| 1084 | + ? $file_paths  | 
                                                        |
| 1085 | + : array($file_paths);  | 
                                                        |
| 1086 | + // cycle thru paths  | 
                                                        |
| 1087 | +		foreach ($file_paths as $key => $file_path) { | 
                                                        |
| 1088 | + // convert all separators to proper DS, if no filepath, then use EE_CLASSES  | 
                                                        |
| 1089 | + $file_path = $file_path  | 
                                                        |
| 1090 | +				? str_replace(array('/', '\\'), DS, $file_path) | 
                                                        |
| 1091 | + : EE_CLASSES;  | 
                                                        |
| 1092 | + // prep file type  | 
                                                        |
| 1093 | + $type = ! empty($type)  | 
                                                        |
| 1094 | + ? trim($type, '.') . '.'  | 
                                                        |
| 1095 | + : '';  | 
                                                        |
| 1096 | + // build full file path  | 
                                                        |
| 1097 | + $file_paths[ $key ] = rtrim($file_path, DS) . DS . $class_name . '.' . $type . 'php';  | 
                                                        |
| 1098 | + //does the file exist and can be read ?  | 
                                                        |
| 1099 | +			if (is_readable($file_paths[ $key ])) { | 
                                                        |
| 1100 | + return $file_paths[ $key ];  | 
                                                        |
| 1101 | + }  | 
                                                        |
| 1102 | + }  | 
                                                        |
| 1103 | + return false;  | 
                                                        |
| 1104 | + }  | 
                                                        |
| 1105 | +  | 
                                                        |
| 1106 | +  | 
                                                        |
| 1107 | + /**  | 
                                                        |
| 1108 | + * basically just performs a require_once()  | 
                                                        |
| 1109 | + * but with some error handling  | 
                                                        |
| 1110 | + *  | 
                                                        |
| 1111 | + * @param string $path  | 
                                                        |
| 1112 | + * @param string $class_name  | 
                                                        |
| 1113 | + * @param string $type  | 
                                                        |
| 1114 | + * @param array $file_paths  | 
                                                        |
| 1115 | + * @return bool  | 
                                                        |
| 1116 | + * @throws EE_Error  | 
                                                        |
| 1117 | + * @throws ReflectionException  | 
                                                        |
| 1118 | + */  | 
                                                        |
| 1119 | + protected function _require_file($path, $class_name, $type = '', $file_paths = array())  | 
                                                        |
| 1120 | +	{ | 
                                                        |
| 1121 | + $this->resolve_legacy_class_parent($class_name);  | 
                                                        |
| 1122 | + // don't give up! you gotta...  | 
                                                        |
| 1123 | +		try { | 
                                                        |
| 1124 | + //does the file exist and can it be read ?  | 
                                                        |
| 1125 | +			if (! $path) { | 
                                                        |
| 1126 | + // just in case the file has already been autoloaded,  | 
                                                        |
| 1127 | + // but discrepancies in the naming schema are preventing it from  | 
                                                        |
| 1128 | + // being loaded via one of the EE_Registry::load_*() methods,  | 
                                                        |
| 1129 | + // then let's try one last hail mary before throwing an exception  | 
                                                        |
| 1130 | + // and call class_exists() again, but with autoloading turned ON  | 
                                                        |
| 1131 | +				if (class_exists($class_name)) { | 
                                                        |
| 1132 | + return true;  | 
                                                        |
| 1133 | + }  | 
                                                        |
| 1134 | + // so sorry, can't find the file  | 
                                                        |
| 1135 | + throw new EE_Error (  | 
                                                        |
| 1136 | + sprintf(  | 
                                                        |
| 1137 | + esc_html__(  | 
                                                        |
| 1138 | + 'The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s',  | 
                                                        |
| 1139 | + 'event_espresso'  | 
                                                        |
| 1140 | + ),  | 
                                                        |
| 1141 | + trim($type, '.'),  | 
                                                        |
| 1142 | + $class_name,  | 
                                                        |
| 1143 | +						'<br />' . implode(',<br />', $file_paths) | 
                                                        |
| 1144 | + )  | 
                                                        |
| 1145 | + );  | 
                                                        |
| 1146 | + }  | 
                                                        |
| 1147 | + // get the file  | 
                                                        |
| 1148 | + require_once($path);  | 
                                                        |
| 1149 | + // if the class isn't already declared somewhere  | 
                                                        |
| 1150 | +			if (class_exists($class_name, false) === false) { | 
                                                        |
| 1151 | + // so sorry, not a class  | 
                                                        |
| 1152 | + throw new EE_Error(  | 
                                                        |
| 1153 | + sprintf(  | 
                                                        |
| 1154 | + esc_html__(  | 
                                                        |
| 1155 | + 'The %s file %s does not appear to contain the %s Class.',  | 
                                                        |
| 1156 | + 'event_espresso'  | 
                                                        |
| 1157 | + ),  | 
                                                        |
| 1158 | + $type,  | 
                                                        |
| 1159 | + $path,  | 
                                                        |
| 1160 | + $class_name  | 
                                                        |
| 1161 | + )  | 
                                                        |
| 1162 | + );  | 
                                                        |
| 1163 | + }  | 
                                                        |
| 1164 | +		} catch (EE_Error $e) { | 
                                                        |
| 1165 | + $e->get_error();  | 
                                                        |
| 1166 | + return false;  | 
                                                        |
| 1167 | + }  | 
                                                        |
| 1168 | + return true;  | 
                                                        |
| 1169 | + }  | 
                                                        |
| 1170 | +  | 
                                                        |
| 1171 | +  | 
                                                        |
| 1172 | + /**  | 
                                                        |
| 1173 | + * Some of our legacy classes that extended a parent class would simply use a require() statement  | 
                                                        |
| 1174 | + * before their class declaration in order to ensure that the parent class was loaded.  | 
                                                        |
| 1175 | + * This is not ideal, but it's nearly impossible to determine the parent class of a non-namespaced class,  | 
                                                        |
| 1176 | + * without triggering a fatal error because the parent class has yet to be loaded and therefore doesn't exist.  | 
                                                        |
| 1177 | + *  | 
                                                        |
| 1178 | + * @param string $class_name  | 
                                                        |
| 1179 | + */  | 
                                                        |
| 1180 | + protected function resolve_legacy_class_parent($class_name = '')  | 
                                                        |
| 1181 | +	{ | 
                                                        |
| 1182 | +		try { | 
                                                        |
| 1183 | + $legacy_parent_class_map = array(  | 
                                                        |
| 1184 | + 'EE_Payment_Processor' => 'core/business/EE_Processor_Base.class.php',  | 
                                                        |
| 1185 | + );  | 
                                                        |
| 1186 | +			if (isset($legacy_parent_class_map[ $class_name ])) { | 
                                                        |
| 1187 | + require_once EE_PLUGIN_DIR_PATH . $legacy_parent_class_map[ $class_name ];  | 
                                                        |
| 1188 | + }  | 
                                                        |
| 1189 | +		} catch (Exception $exception) { | 
                                                        |
| 1190 | + }  | 
                                                        |
| 1191 | + }  | 
                                                        |
| 1192 | +  | 
                                                        |
| 1193 | +  | 
                                                        |
| 1194 | + /**  | 
                                                        |
| 1195 | + * _create_object  | 
                                                        |
| 1196 | + * Attempts to instantiate the requested class via any of the  | 
                                                        |
| 1197 | + * commonly used instantiation methods employed throughout EE.  | 
                                                        |
| 1198 | + * The priority for instantiation is as follows:  | 
                                                        |
| 1199 | + * - abstract classes or any class flagged as "load only" (no instantiation occurs)  | 
                                                        |
| 1200 | + * - model objects via their 'new_instance_from_db' method  | 
                                                        |
| 1201 | + * - model objects via their 'new_instance' method  | 
                                                        |
| 1202 | + * - "singleton" classes" via their 'instance' method  | 
                                                        |
| 1203 | + * - standard instantiable classes via their __constructor  | 
                                                        |
| 1204 | + * Prior to instantiation, if the classname exists in the dependency_map,  | 
                                                        |
| 1205 | + * then the constructor for the requested class will be examined to determine  | 
                                                        |
| 1206 | + * if any dependencies exist, and if they can be injected.  | 
                                                        |
| 1207 | + * If so, then those classes will be added to the array of arguments passed to the constructor  | 
                                                        |
| 1208 | + *  | 
                                                        |
| 1209 | + * @param string $class_name  | 
                                                        |
| 1210 | + * @param array $arguments  | 
                                                        |
| 1211 | + * @param string $type  | 
                                                        |
| 1212 | + * @param bool $from_db  | 
                                                        |
| 1213 | + * @return null|object|bool  | 
                                                        |
| 1214 | + * @throws InvalidArgumentException  | 
                                                        |
| 1215 | + * @throws InvalidInterfaceException  | 
                                                        |
| 1216 | + * @throws EE_Error  | 
                                                        |
| 1217 | + * @throws ReflectionException  | 
                                                        |
| 1218 | + * @throws InvalidDataTypeException  | 
                                                        |
| 1219 | + */  | 
                                                        |
| 1220 | + protected function _create_object($class_name, $arguments = array(), $type = '', $from_db = false)  | 
                                                        |
| 1221 | +	{ | 
                                                        |
| 1222 | + // create reflection  | 
                                                        |
| 1223 | + $reflector = $this->mirror->getReflectionClass($class_name);  | 
                                                        |
| 1224 | + // make sure arguments are an array  | 
                                                        |
| 1225 | + $arguments = is_array($arguments)  | 
                                                        |
| 1226 | + ? $arguments  | 
                                                        |
| 1227 | + : array($arguments);  | 
                                                        |
| 1228 | + // and if arguments array is numerically and sequentially indexed, then we want it to remain as is,  | 
                                                        |
| 1229 | + // else wrap it in an additional array so that it doesn't get split into multiple parameters  | 
                                                        |
| 1230 | + $arguments = $this->_array_is_numerically_and_sequentially_indexed($arguments)  | 
                                                        |
| 1231 | + ? $arguments  | 
                                                        |
| 1232 | + : array($arguments);  | 
                                                        |
| 1233 | + // attempt to inject dependencies ?  | 
                                                        |
| 1234 | +		if ($this->_dependency_map->has($class_name)) { | 
                                                        |
| 1235 | + $arguments = $this->_resolve_dependencies($reflector, $class_name, $arguments);  | 
                                                        |
| 1236 | + }  | 
                                                        |
| 1237 | + // instantiate the class if possible  | 
                                                        |
| 1238 | +		if ($reflector->isAbstract()) { | 
                                                        |
| 1239 | + // nothing to instantiate, loading file was enough  | 
                                                        |
| 1240 | + // does not throw an exception so $instantiation_mode is unused  | 
                                                        |
| 1241 | + // $instantiation_mode = "1) no constructor abstract class";  | 
                                                        |
| 1242 | + return true;  | 
                                                        |
| 1243 | + }  | 
                                                        |
| 1244 | + if (  | 
                                                        |
| 1245 | + empty($arguments)  | 
                                                        |
| 1246 | + && $this->mirror->getConstructorFromReflection($reflector) === null  | 
                                                        |
| 1247 | + && $reflector->isInstantiable()  | 
                                                        |
| 1248 | +		) { | 
                                                        |
| 1249 | + // no constructor = static methods only... nothing to instantiate, loading file was enough  | 
                                                        |
| 1250 | + // $instantiation_mode = "2) no constructor but instantiable";  | 
                                                        |
| 1251 | + return $reflector->newInstance();  | 
                                                        |
| 1252 | + }  | 
                                                        |
| 1253 | +		if ($from_db && method_exists($class_name, 'new_instance_from_db')) { | 
                                                        |
| 1254 | + // $instantiation_mode = "3) new_instance_from_db()";  | 
                                                        |
| 1255 | + return call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments);  | 
                                                        |
| 1256 | + }  | 
                                                        |
| 1257 | +		if (method_exists($class_name, 'new_instance')) { | 
                                                        |
| 1258 | + // $instantiation_mode = "4) new_instance()";  | 
                                                        |
| 1259 | + return call_user_func_array(array($class_name, 'new_instance'), $arguments);  | 
                                                        |
| 1260 | + }  | 
                                                        |
| 1261 | +		if (method_exists($class_name, 'instance')) { | 
                                                        |
| 1262 | + // $instantiation_mode = "5) instance()";  | 
                                                        |
| 1263 | + return call_user_func_array(array($class_name, 'instance'), $arguments);  | 
                                                        |
| 1264 | + }  | 
                                                        |
| 1265 | +		if ($reflector->isInstantiable()) { | 
                                                        |
| 1266 | + // $instantiation_mode = "6) constructor";  | 
                                                        |
| 1267 | + return $reflector->newInstanceArgs($arguments);  | 
                                                        |
| 1268 | + }  | 
                                                        |
| 1269 | + // heh ? something's not right !  | 
                                                        |
| 1270 | + throw new EE_Error(  | 
                                                        |
| 1271 | + sprintf(  | 
                                                        |
| 1272 | +				__('The %s file %s could not be instantiated.', 'event_espresso'), | 
                                                        |
| 1273 | + $type,  | 
                                                        |
| 1274 | + $class_name  | 
                                                        |
| 1275 | + )  | 
                                                        |
| 1276 | + );  | 
                                                        |
| 1277 | + }  | 
                                                        |
| 1278 | +  | 
                                                        |
| 1279 | +  | 
                                                        |
| 1280 | + /**  | 
                                                        |
| 1281 | + * @see http://stackoverflow.com/questions/173400/how-to-check-if-php-array-is-associative-or-sequential  | 
                                                        |
| 1282 | + * @param array $array  | 
                                                        |
| 1283 | + * @return bool  | 
                                                        |
| 1284 | + */  | 
                                                        |
| 1285 | + protected function _array_is_numerically_and_sequentially_indexed(array $array)  | 
                                                        |
| 1286 | +	{ | 
                                                        |
| 1287 | + return ! empty($array)  | 
                                                        |
| 1288 | + ? array_keys($array) === range(0, count($array) - 1)  | 
                                                        |
| 1289 | + : true;  | 
                                                        |
| 1290 | + }  | 
                                                        |
| 1291 | +  | 
                                                        |
| 1292 | +  | 
                                                        |
| 1293 | + /**  | 
                                                        |
| 1294 | + * _resolve_dependencies  | 
                                                        |
| 1295 | + * examines the constructor for the requested class to determine  | 
                                                        |
| 1296 | + * if any dependencies exist, and if they can be injected.  | 
                                                        |
| 1297 | + * If so, then those classes will be added to the array of arguments passed to the constructor  | 
                                                        |
| 1298 | + * PLZ NOTE: this is achieved by type hinting the constructor params  | 
                                                        |
| 1299 | + * For example:  | 
                                                        |
| 1300 | + * if attempting to load a class "Foo" with the following constructor:  | 
                                                        |
| 1301 | + * __construct( Bar $bar_class, Fighter $grohl_class )  | 
                                                        |
| 1302 | + * then $bar_class and $grohl_class will be added to the $arguments array,  | 
                                                        |
| 1303 | + * but only IF they are NOT already present in the incoming arguments array,  | 
                                                        |
| 1304 | + * and the correct classes can be loaded  | 
                                                        |
| 1305 | + *  | 
                                                        |
| 1306 | + * @param ReflectionClass $reflector  | 
                                                        |
| 1307 | + * @param string $class_name  | 
                                                        |
| 1308 | + * @param array $arguments  | 
                                                        |
| 1309 | + * @return array  | 
                                                        |
| 1310 | + * @throws InvalidArgumentException  | 
                                                        |
| 1311 | + * @throws InvalidDataTypeException  | 
                                                        |
| 1312 | + * @throws InvalidInterfaceException  | 
                                                        |
| 1313 | + * @throws ReflectionException  | 
                                                        |
| 1314 | + */  | 
                                                        |
| 1315 | + protected function _resolve_dependencies(ReflectionClass $reflector, $class_name, array $arguments = array())  | 
                                                        |
| 1316 | +	{ | 
                                                        |
| 1317 | + // let's examine the constructor  | 
                                                        |
| 1318 | + $constructor = $this->mirror->getConstructorFromReflection($reflector);  | 
                                                        |
| 1319 | + // whu? huh? nothing?  | 
                                                        |
| 1320 | +		if (! $constructor) { | 
                                                        |
| 1321 | + return $arguments;  | 
                                                        |
| 1322 | + }  | 
                                                        |
| 1323 | + // get constructor parameters  | 
                                                        |
| 1324 | + $params = $this->mirror->getParametersFromReflection($reflector);  | 
                                                        |
| 1325 | + // and the keys for the incoming arguments array so that we can compare existing arguments with what is expected  | 
                                                        |
| 1326 | + $argument_keys = array_keys($arguments);  | 
                                                        |
| 1327 | + // now loop thru all of the constructors expected parameters  | 
                                                        |
| 1328 | +		foreach ($params as $index => $param) { | 
                                                        |
| 1329 | + // is this a dependency for a specific class ?  | 
                                                        |
| 1330 | + $param_class = $this->mirror->getParameterClassName($param, $class_name, $index);  | 
                                                        |
| 1331 | + // BUT WAIT !!! This class may be an alias for something else (or getting replaced at runtime)  | 
                                                        |
| 1332 | + $param_class = $this->class_cache->isAlias($param_class, $class_name)  | 
                                                        |
| 1333 | + ? $this->class_cache->getFqnForAlias($param_class, $class_name)  | 
                                                        |
| 1334 | + : $param_class;  | 
                                                        |
| 1335 | + if (  | 
                                                        |
| 1336 | + // param is not even a class  | 
                                                        |
| 1337 | + $param_class === null  | 
                                                        |
| 1338 | + // and something already exists in the incoming arguments for this param  | 
                                                        |
| 1339 | + && array_key_exists($index, $argument_keys)  | 
                                                        |
| 1340 | + && array_key_exists($argument_keys[ $index ], $arguments)  | 
                                                        |
| 1341 | +			) { | 
                                                        |
| 1342 | + // so let's skip this argument and move on to the next  | 
                                                        |
| 1343 | + continue;  | 
                                                        |
| 1344 | + }  | 
                                                        |
| 1345 | + if (  | 
                                                        |
| 1346 | + // parameter is type hinted as a class, exists as an incoming argument, AND it's the correct class  | 
                                                        |
| 1347 | + $param_class !== null  | 
                                                        |
| 1348 | + && isset($argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ])  | 
                                                        |
| 1349 | + && $arguments[ $argument_keys[ $index ] ] instanceof $param_class  | 
                                                        |
| 1350 | +			) { | 
                                                        |
| 1351 | + // skip this argument and move on to the next  | 
                                                        |
| 1352 | + continue;  | 
                                                        |
| 1353 | + }  | 
                                                        |
| 1354 | + if (  | 
                                                        |
| 1355 | + // parameter is type hinted as a class, and should be injected  | 
                                                        |
| 1356 | + $param_class !== null  | 
                                                        |
| 1357 | + && $this->_dependency_map->has_dependency_for_class($class_name, $param_class)  | 
                                                        |
| 1358 | +			) { | 
                                                        |
| 1359 | + $arguments = $this->_resolve_dependency(  | 
                                                        |
| 1360 | + $class_name,  | 
                                                        |
| 1361 | + $param_class,  | 
                                                        |
| 1362 | + $arguments,  | 
                                                        |
| 1363 | + $index  | 
                                                        |
| 1364 | + );  | 
                                                        |
| 1365 | +			} else { | 
                                                        |
| 1366 | + $arguments[ $index ] = $this->mirror->getParameterDefaultValue(  | 
                                                        |
| 1367 | + $param,  | 
                                                        |
| 1368 | + $class_name,  | 
                                                        |
| 1369 | + $index  | 
                                                        |
| 1370 | + );  | 
                                                        |
| 1371 | + }  | 
                                                        |
| 1372 | + }  | 
                                                        |
| 1373 | + return $arguments;  | 
                                                        |
| 1374 | + }  | 
                                                        |
| 1375 | +  | 
                                                        |
| 1376 | +  | 
                                                        |
| 1377 | + /**  | 
                                                        |
| 1378 | + * @param string $class_name  | 
                                                        |
| 1379 | + * @param string $param_class  | 
                                                        |
| 1380 | + * @param array $arguments  | 
                                                        |
| 1381 | + * @param mixed $index  | 
                                                        |
| 1382 | + * @return array  | 
                                                        |
| 1383 | + * @throws InvalidArgumentException  | 
                                                        |
| 1384 | + * @throws InvalidInterfaceException  | 
                                                        |
| 1385 | + * @throws InvalidDataTypeException  | 
                                                        |
| 1386 | + */  | 
                                                        |
| 1387 | + protected function _resolve_dependency($class_name, $param_class, $arguments, $index)  | 
                                                        |
| 1388 | +	{ | 
                                                        |
| 1389 | + $dependency = null;  | 
                                                        |
| 1390 | + // should dependency be loaded from cache ?  | 
                                                        |
| 1391 | + $cache_on = $this->_dependency_map->loading_strategy_for_class_dependency(  | 
                                                        |
| 1392 | + $class_name,  | 
                                                        |
| 1393 | + $param_class  | 
                                                        |
| 1394 | + );  | 
                                                        |
| 1395 | + $cache_on = $cache_on !== EE_Dependency_Map::load_new_object;  | 
                                                        |
| 1396 | + // we might have a dependency...  | 
                                                        |
| 1397 | + // let's MAYBE try and find it in our cache if that's what's been requested  | 
                                                        |
| 1398 | + $cached_class = $cache_on  | 
                                                        |
| 1399 | + ? $this->_get_cached_class($param_class)  | 
                                                        |
| 1400 | + : null;  | 
                                                        |
| 1401 | + // and grab it if it exists  | 
                                                        |
| 1402 | +		if ($cached_class instanceof $param_class) { | 
                                                        |
| 1403 | + $dependency = $cached_class;  | 
                                                        |
| 1404 | +		} elseif ($param_class !== $class_name) { | 
                                                        |
| 1405 | + // obtain the loader method from the dependency map  | 
                                                        |
| 1406 | + $loader = $this->_dependency_map->class_loader($param_class);  | 
                                                        |
| 1407 | + // is loader a custom closure ?  | 
                                                        |
| 1408 | +			if ($loader instanceof Closure) { | 
                                                        |
| 1409 | + $dependency = $loader($arguments);  | 
                                                        |
| 1410 | +			} else { | 
                                                        |
| 1411 | + // set the cache on property for the recursive loading call  | 
                                                        |
| 1412 | + $this->_cache_on = $cache_on;  | 
                                                        |
| 1413 | + // if not, then let's try and load it via the registry  | 
                                                        |
| 1414 | +				if ($loader && method_exists($this, $loader)) { | 
                                                        |
| 1415 | +					$dependency = $this->{$loader}($param_class); | 
                                                        |
| 1416 | +				} else { | 
                                                        |
| 1417 | + $dependency = LoaderFactory::getLoader()->load(  | 
                                                        |
| 1418 | + $param_class,  | 
                                                        |
| 1419 | + array(),  | 
                                                        |
| 1420 | + $cache_on  | 
                                                        |
| 1421 | + );  | 
                                                        |
| 1422 | + }  | 
                                                        |
| 1423 | + }  | 
                                                        |
| 1424 | + }  | 
                                                        |
| 1425 | + // did we successfully find the correct dependency ?  | 
                                                        |
| 1426 | +		if ($dependency instanceof $param_class) { | 
                                                        |
| 1427 | + // then let's inject it into the incoming array of arguments at the correct location  | 
                                                        |
| 1428 | + $arguments[ $index ] = $dependency;  | 
                                                        |
| 1429 | + }  | 
                                                        |
| 1430 | + return $arguments;  | 
                                                        |
| 1431 | + }  | 
                                                        |
| 1432 | +  | 
                                                        |
| 1433 | +  | 
                                                        |
| 1434 | + /**  | 
                                                        |
| 1435 | + * call any loader that's been registered in the EE_Dependency_Map::$_class_loaders array  | 
                                                        |
| 1436 | + *  | 
                                                        |
| 1437 | + * @param string $classname PLEASE NOTE: the class name needs to match what's registered  | 
                                                        |
| 1438 | + * in the EE_Dependency_Map::$_class_loaders array,  | 
                                                        |
| 1439 | + * including the class prefix, ie: "EE_", "EEM_", "EEH_", etc  | 
                                                        |
| 1440 | + * @param array $arguments  | 
                                                        |
| 1441 | + * @return object  | 
                                                        |
| 1442 | + */  | 
                                                        |
| 1443 | + public static function factory($classname, $arguments = array())  | 
                                                        |
| 1444 | +	{ | 
                                                        |
| 1445 | + $loader = self::instance()->_dependency_map->class_loader($classname);  | 
                                                        |
| 1446 | +		if ($loader instanceof Closure) { | 
                                                        |
| 1447 | + return $loader($arguments);  | 
                                                        |
| 1448 | + }  | 
                                                        |
| 1449 | +		if (method_exists(self::instance(), $loader)) { | 
                                                        |
| 1450 | +			return self::instance()->{$loader}($classname, $arguments); | 
                                                        |
| 1451 | + }  | 
                                                        |
| 1452 | + return null;  | 
                                                        |
| 1453 | + }  | 
                                                        |
| 1454 | +  | 
                                                        |
| 1455 | +  | 
                                                        |
| 1456 | + /**  | 
                                                        |
| 1457 | + * Gets the addon by its class name  | 
                                                        |
| 1458 | + *  | 
                                                        |
| 1459 | + * @param string $class_name  | 
                                                        |
| 1460 | + * @return EE_Addon  | 
                                                        |
| 1461 | + */  | 
                                                        |
| 1462 | + public function getAddon($class_name)  | 
                                                        |
| 1463 | +	{ | 
                                                        |
| 1464 | +		$class_name = str_replace('\\', '_', $class_name); | 
                                                        |
| 1465 | +		return $this->addons->{$class_name}; | 
                                                        |
| 1466 | + }  | 
                                                        |
| 1467 | +  | 
                                                        |
| 1468 | +  | 
                                                        |
| 1469 | + /**  | 
                                                        |
| 1470 | + * removes the addon from the internal cache  | 
                                                        |
| 1471 | + *  | 
                                                        |
| 1472 | + * @param string $class_name  | 
                                                        |
| 1473 | + * @return void  | 
                                                        |
| 1474 | + */  | 
                                                        |
| 1475 | + public function removeAddon($class_name)  | 
                                                        |
| 1476 | +	{ | 
                                                        |
| 1477 | +		$class_name = str_replace('\\', '_', $class_name); | 
                                                        |
| 1478 | +		unset($this->addons->{$class_name}); | 
                                                        |
| 1479 | + }  | 
                                                        |
| 1480 | +  | 
                                                        |
| 1481 | +  | 
                                                        |
| 1482 | + /**  | 
                                                        |
| 1483 | + * Gets the addon by its name/slug (not classname. For that, just  | 
                                                        |
| 1484 | + * use the get_addon() method above  | 
                                                        |
| 1485 | + *  | 
                                                        |
| 1486 | + * @param string $name  | 
                                                        |
| 1487 | + * @return EE_Addon  | 
                                                        |
| 1488 | + */  | 
                                                        |
| 1489 | + public function get_addon_by_name($name)  | 
                                                        |
| 1490 | +	{ | 
                                                        |
| 1491 | +		foreach ($this->addons as $addon) { | 
                                                        |
| 1492 | +			if ($addon->name() === $name) { | 
                                                        |
| 1493 | + return $addon;  | 
                                                        |
| 1494 | + }  | 
                                                        |
| 1495 | + }  | 
                                                        |
| 1496 | + return null;  | 
                                                        |
| 1497 | + }  | 
                                                        |
| 1498 | +  | 
                                                        |
| 1499 | +  | 
                                                        |
| 1500 | + /**  | 
                                                        |
| 1501 | + * Gets an array of all the registered addons, where the keys are their names.  | 
                                                        |
| 1502 | + * (ie, what each returns for their name() function)  | 
                                                        |
| 1503 | + * They're already available on EE_Registry::instance()->addons as properties,  | 
                                                        |
| 1504 | + * where each property's name is the addon's classname,  | 
                                                        |
| 1505 | + * So if you just want to get the addon by classname,  | 
                                                        |
| 1506 | + * OR use the get_addon() method above.  | 
                                                        |
| 1507 | + * PLEASE NOTE:  | 
                                                        |
| 1508 | + * addons with Fully Qualified Class Names  | 
                                                        |
| 1509 | + * have had the namespace separators converted to underscores,  | 
                                                        |
| 1510 | + * so a classname like Fully\Qualified\ClassName  | 
                                                        |
| 1511 | + * would have been converted to Fully_Qualified_ClassName  | 
                                                        |
| 1512 | + *  | 
                                                        |
| 1513 | + * @return EE_Addon[] where the KEYS are the addon's name()  | 
                                                        |
| 1514 | + */  | 
                                                        |
| 1515 | + public function get_addons_by_name()  | 
                                                        |
| 1516 | +	{ | 
                                                        |
| 1517 | + $addons = array();  | 
                                                        |
| 1518 | +		foreach ($this->addons as $addon) { | 
                                                        |
| 1519 | + $addons[ $addon->name() ] = $addon;  | 
                                                        |
| 1520 | + }  | 
                                                        |
| 1521 | + return $addons;  | 
                                                        |
| 1522 | + }  | 
                                                        |
| 1523 | +  | 
                                                        |
| 1524 | +  | 
                                                        |
| 1525 | + /**  | 
                                                        |
| 1526 | + * Resets the specified model's instance AND makes sure EE_Registry doesn't keep  | 
                                                        |
| 1527 | + * a stale copy of it around  | 
                                                        |
| 1528 | + *  | 
                                                        |
| 1529 | + * @param string $model_name  | 
                                                        |
| 1530 | + * @return \EEM_Base  | 
                                                        |
| 1531 | + * @throws \EE_Error  | 
                                                        |
| 1532 | + */  | 
                                                        |
| 1533 | + public function reset_model($model_name)  | 
                                                        |
| 1534 | +	{ | 
                                                        |
| 1535 | + $model_class_name = strpos($model_name, 'EEM_') !== 0  | 
                                                        |
| 1536 | +			? "EEM_{$model_name}" | 
                                                        |
| 1537 | + : $model_name;  | 
                                                        |
| 1538 | +		if (! isset($this->LIB->{$model_class_name}) || ! $this->LIB->{$model_class_name} instanceof EEM_Base) { | 
                                                        |
| 1539 | + return null;  | 
                                                        |
| 1540 | + }  | 
                                                        |
| 1541 | + //get that model reset it and make sure we nuke the old reference to it  | 
                                                        |
| 1542 | +		if ($this->LIB->{$model_class_name} instanceof $model_class_name | 
                                                        |
| 1543 | + && is_callable(  | 
                                                        |
| 1544 | + array($model_class_name, 'reset')  | 
                                                        |
| 1545 | +			)) { | 
                                                        |
| 1546 | +			$this->LIB->{$model_class_name} = $this->LIB->{$model_class_name}->reset(); | 
                                                        |
| 1547 | +		} else { | 
                                                        |
| 1548 | + throw new EE_Error(  | 
                                                        |
| 1549 | + sprintf(  | 
                                                        |
| 1550 | +					esc_html__('Model %s does not have a method "reset"', 'event_espresso'), | 
                                                        |
| 1551 | + $model_name  | 
                                                        |
| 1552 | + )  | 
                                                        |
| 1553 | + );  | 
                                                        |
| 1554 | + }  | 
                                                        |
| 1555 | +		return $this->LIB->{$model_class_name}; | 
                                                        |
| 1556 | + }  | 
                                                        |
| 1557 | +  | 
                                                        |
| 1558 | +  | 
                                                        |
| 1559 | + /**  | 
                                                        |
| 1560 | + * Resets the registry.  | 
                                                        |
| 1561 | + * The criteria for what gets reset is based on what can be shared between sites on the same request when  | 
                                                        |
| 1562 | + * switch_to_blog is used in a multisite install. Here is a list of things that are NOT reset.  | 
                                                        |
| 1563 | + * - $_dependency_map  | 
                                                        |
| 1564 | + * - $_class_abbreviations  | 
                                                        |
| 1565 | + * - $NET_CFG (EE_Network_Config): The config is shared network wide so no need to reset.  | 
                                                        |
| 1566 | + * - $REQ: Still on the same request so no need to change.  | 
                                                        |
| 1567 | + * - $CAP: There is no site specific state in the EE_Capability class.  | 
                                                        |
| 1568 | + * - $SSN: Although ideally, the session should not be shared between site switches, we can't reset it because only  | 
                                                        |
| 1569 | + * one Session can be active in a single request. Resetting could resolve in "headers already sent" errors.  | 
                                                        |
| 1570 | + * - $addons: In multisite, the state of the addons is something controlled via hooks etc in a normal request. So  | 
                                                        |
| 1571 | + * for now, we won't reset the addons because it could break calls to an add-ons class/methods in the  | 
                                                        |
| 1572 | + * switch or on the restore.  | 
                                                        |
| 1573 | + * - $modules  | 
                                                        |
| 1574 | + * - $shortcodes  | 
                                                        |
| 1575 | + * - $widgets  | 
                                                        |
| 1576 | + *  | 
                                                        |
| 1577 | + * @param boolean $hard [deprecated]  | 
                                                        |
| 1578 | + * @param boolean $reinstantiate whether to create new instances of EE_Registry's singletons too,  | 
                                                        |
| 1579 | + * or just reset without re-instantiating (handy to set to FALSE if you're not  | 
                                                        |
| 1580 | + * sure if you CAN currently reinstantiate the singletons at the moment)  | 
                                                        |
| 1581 | + * @param bool $reset_models Defaults to true. When false, then the models are not reset. This is so  | 
                                                        |
| 1582 | + * client  | 
                                                        |
| 1583 | + * code instead can just change the model context to a different blog id if  | 
                                                        |
| 1584 | + * necessary  | 
                                                        |
| 1585 | + * @return EE_Registry  | 
                                                        |
| 1586 | + * @throws InvalidInterfaceException  | 
                                                        |
| 1587 | + * @throws InvalidDataTypeException  | 
                                                        |
| 1588 | + * @throws EE_Error  | 
                                                        |
| 1589 | + * @throws ReflectionException  | 
                                                        |
| 1590 | + * @throws InvalidArgumentException  | 
                                                        |
| 1591 | + */  | 
                                                        |
| 1592 | + public static function reset($hard = false, $reinstantiate = true, $reset_models = true)  | 
                                                        |
| 1593 | +	{ | 
                                                        |
| 1594 | + $instance = self::instance();  | 
                                                        |
| 1595 | + $instance->_cache_on = true;  | 
                                                        |
| 1596 | + // reset some "special" classes  | 
                                                        |
| 1597 | + EEH_Activation::reset();  | 
                                                        |
| 1598 | +		$hard                     = apply_filters('FHEE__EE_Registry__reset__hard', $hard); | 
                                                        |
| 1599 | + $instance->CFG = EE_Config::reset($hard, $reinstantiate);  | 
                                                        |
| 1600 | + $instance->CART = null;  | 
                                                        |
| 1601 | + $instance->MRM = null;  | 
                                                        |
| 1602 | +		$instance->AssetsRegistry = $instance->create('EventEspresso\core\services\assets\Registry'); | 
                                                        |
| 1603 | + //messages reset  | 
                                                        |
| 1604 | + EED_Messages::reset();  | 
                                                        |
| 1605 | + //handle of objects cached on LIB  | 
                                                        |
| 1606 | +		foreach (array('LIB', 'modules') as $cache) { | 
                                                        |
| 1607 | +			foreach ($instance->{$cache} as $class_name => $class) { | 
                                                        |
| 1608 | +				if (self::_reset_and_unset_object($class, $reset_models)) { | 
                                                        |
| 1609 | +					unset($instance->{$cache}->{$class_name}); | 
                                                        |
| 1610 | + }  | 
                                                        |
| 1611 | + }  | 
                                                        |
| 1612 | + }  | 
                                                        |
| 1613 | + return $instance;  | 
                                                        |
| 1614 | + }  | 
                                                        |
| 1615 | +  | 
                                                        |
| 1616 | +  | 
                                                        |
| 1617 | + /**  | 
                                                        |
| 1618 | + * if passed object implements ResettableInterface, then call it's reset() method  | 
                                                        |
| 1619 | + * if passed object implements InterminableInterface, then return false,  | 
                                                        |
| 1620 | + * to indicate that it should NOT be cleared from the Registry cache  | 
                                                        |
| 1621 | + *  | 
                                                        |
| 1622 | + * @param $object  | 
                                                        |
| 1623 | + * @param bool $reset_models  | 
                                                        |
| 1624 | + * @return bool returns true if cached object should be unset  | 
                                                        |
| 1625 | + */  | 
                                                        |
| 1626 | + private static function _reset_and_unset_object($object, $reset_models)  | 
                                                        |
| 1627 | +	{ | 
                                                        |
| 1628 | +		if (! is_object($object)) { | 
                                                        |
| 1629 | + // don't unset anything that's not an object  | 
                                                        |
| 1630 | + return false;  | 
                                                        |
| 1631 | + }  | 
                                                        |
| 1632 | +		if ($object instanceof EED_Module) { | 
                                                        |
| 1633 | + $object::reset();  | 
                                                        |
| 1634 | + // don't unset modules  | 
                                                        |
| 1635 | + return false;  | 
                                                        |
| 1636 | + }  | 
                                                        |
| 1637 | +		if ($object instanceof ResettableInterface) { | 
                                                        |
| 1638 | +			if ($object instanceof EEM_Base) { | 
                                                        |
| 1639 | +				if ($reset_models) { | 
                                                        |
| 1640 | + $object->reset();  | 
                                                        |
| 1641 | + return true;  | 
                                                        |
| 1642 | + }  | 
                                                        |
| 1643 | + return false;  | 
                                                        |
| 1644 | + }  | 
                                                        |
| 1645 | + $object->reset();  | 
                                                        |
| 1646 | + return true;  | 
                                                        |
| 1647 | + }  | 
                                                        |
| 1648 | +		if (! $object instanceof InterminableInterface) { | 
                                                        |
| 1649 | + return true;  | 
                                                        |
| 1650 | + }  | 
                                                        |
| 1651 | + return false;  | 
                                                        |
| 1652 | + }  | 
                                                        |
| 1653 | +  | 
                                                        |
| 1654 | +  | 
                                                        |
| 1655 | + /**  | 
                                                        |
| 1656 | + * Gets all the custom post type models defined  | 
                                                        |
| 1657 | + *  | 
                                                        |
| 1658 | + * @return array keys are model "short names" (Eg "Event") and keys are classnames (eg "EEM_Event")  | 
                                                        |
| 1659 | + */  | 
                                                        |
| 1660 | + public function cpt_models()  | 
                                                        |
| 1661 | +	{ | 
                                                        |
| 1662 | + $cpt_models = array();  | 
                                                        |
| 1663 | +		foreach ($this->non_abstract_db_models as $short_name => $classname) { | 
                                                        |
| 1664 | +			if (is_subclass_of($classname, 'EEM_CPT_Base')) { | 
                                                        |
| 1665 | + $cpt_models[ $short_name ] = $classname;  | 
                                                        |
| 1666 | + }  | 
                                                        |
| 1667 | + }  | 
                                                        |
| 1668 | + return $cpt_models;  | 
                                                        |
| 1669 | + }  | 
                                                        |
| 1670 | +  | 
                                                        |
| 1671 | +  | 
                                                        |
| 1672 | + /**  | 
                                                        |
| 1673 | + * @return \EE_Config  | 
                                                        |
| 1674 | + */  | 
                                                        |
| 1675 | + public static function CFG()  | 
                                                        |
| 1676 | +	{ | 
                                                        |
| 1677 | + return self::instance()->CFG;  | 
                                                        |
| 1678 | + }  | 
                                                        |
| 1679 | +  | 
                                                        |
| 1680 | +  | 
                                                        |
| 1681 | + /**  | 
                                                        |
| 1682 | + * @deprecated $VID:$  | 
                                                        |
| 1683 | + * @param string $class_name  | 
                                                        |
| 1684 | + * @return ReflectionClass  | 
                                                        |
| 1685 | + * @throws ReflectionException  | 
                                                        |
| 1686 | + * @throws InvalidDataTypeException  | 
                                                        |
| 1687 | + */  | 
                                                        |
| 1688 | + public function get_ReflectionClass($class_name)  | 
                                                        |
| 1689 | +	{ | 
                                                        |
| 1690 | + return $this->mirror->getReflectionClass($class_name);  | 
                                                        |
| 1691 | + }  | 
                                                        |
| 1692 | 1692 | }  | 
                                                        
| 1693 | 1693 | // End of file EE_Registry.core.php  | 
                                                        
| 1694 | 1694 | // Location: ./core/EE_Registry.core.php  | 
                                                        
@@ -8,7 +8,7 @@ discard block  | 
                                                    ||
| 8 | 8 | use EventEspresso\core\services\request\ResponseInterface;  | 
                                                        
| 9 | 9 | |
| 10 | 10 |  if (! defined('EVENT_ESPRESSO_VERSION')) { | 
                                                        
| 11 | -    exit('No direct script access allowed'); | 
                                                        |
| 11 | +	exit('No direct script access allowed'); | 
                                                        |
| 12 | 12 | }  | 
                                                        
| 13 | 13 | |
| 14 | 14 | |
@@ -25,884 +25,884 @@ discard block  | 
                                                    ||
| 25 | 25 | class EE_Dependency_Map  | 
                                                        
| 26 | 26 |  { | 
                                                        
| 27 | 27 | |
| 28 | - /**  | 
                                                        |
| 29 | - * This means that the requested class dependency is not present in the dependency map  | 
                                                        |
| 30 | - */  | 
                                                        |
| 31 | - const not_registered = 0;  | 
                                                        |
| 32 | -  | 
                                                        |
| 33 | - /**  | 
                                                        |
| 34 | - * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class.  | 
                                                        |
| 35 | - */  | 
                                                        |
| 36 | - const load_new_object = 1;  | 
                                                        |
| 37 | -  | 
                                                        |
| 38 | - /**  | 
                                                        |
| 39 | - * This instructs class loaders to return a previously instantiated and cached object for the requested class.  | 
                                                        |
| 40 | - * IF a previously instantiated object does not exist, a new one will be created and added to the cache.  | 
                                                        |
| 41 | - */  | 
                                                        |
| 42 | - const load_from_cache = 2;  | 
                                                        |
| 43 | -  | 
                                                        |
| 44 | - /**  | 
                                                        |
| 45 | - * When registering a dependency,  | 
                                                        |
| 46 | - * this indicates to keep any existing dependencies that already exist,  | 
                                                        |
| 47 | - * and simply discard any new dependencies declared in the incoming data  | 
                                                        |
| 48 | - */  | 
                                                        |
| 49 | - const KEEP_EXISTING_DEPENDENCIES = 0;  | 
                                                        |
| 50 | -  | 
                                                        |
| 51 | - /**  | 
                                                        |
| 52 | - * When registering a dependency,  | 
                                                        |
| 53 | - * this indicates to overwrite any existing dependencies that already exist using the incoming data  | 
                                                        |
| 54 | - */  | 
                                                        |
| 55 | - const OVERWRITE_DEPENDENCIES = 1;  | 
                                                        |
| 56 | -  | 
                                                        |
| 57 | -  | 
                                                        |
| 58 | -  | 
                                                        |
| 59 | - /**  | 
                                                        |
| 60 | - * @type EE_Dependency_Map $_instance  | 
                                                        |
| 61 | - */  | 
                                                        |
| 62 | - protected static $_instance;  | 
                                                        |
| 63 | -  | 
                                                        |
| 64 | - /**  | 
                                                        |
| 65 | - * @var ClassInterfaceCache $class_cache  | 
                                                        |
| 66 | - */  | 
                                                        |
| 67 | - private $class_cache;  | 
                                                        |
| 68 | -  | 
                                                        |
| 69 | - /**  | 
                                                        |
| 70 | - * @type RequestInterface $request  | 
                                                        |
| 71 | - */  | 
                                                        |
| 72 | - protected $request;  | 
                                                        |
| 73 | -  | 
                                                        |
| 74 | - /**  | 
                                                        |
| 75 | - * @type LegacyRequestInterface $legacy_request  | 
                                                        |
| 76 | - */  | 
                                                        |
| 77 | - protected $legacy_request;  | 
                                                        |
| 78 | -  | 
                                                        |
| 79 | - /**  | 
                                                        |
| 80 | - * @type ResponseInterface $response  | 
                                                        |
| 81 | - */  | 
                                                        |
| 82 | - protected $response;  | 
                                                        |
| 83 | -  | 
                                                        |
| 84 | - /**  | 
                                                        |
| 85 | - * @type LoaderInterface $loader  | 
                                                        |
| 86 | - */  | 
                                                        |
| 87 | - protected $loader;  | 
                                                        |
| 88 | -  | 
                                                        |
| 89 | - /**  | 
                                                        |
| 90 | - * @type array $_dependency_map  | 
                                                        |
| 91 | - */  | 
                                                        |
| 92 | - protected $_dependency_map = array();  | 
                                                        |
| 93 | -  | 
                                                        |
| 94 | - /**  | 
                                                        |
| 95 | - * @type array $_class_loaders  | 
                                                        |
| 96 | - */  | 
                                                        |
| 97 | - protected $_class_loaders = array();  | 
                                                        |
| 98 | -  | 
                                                        |
| 99 | -  | 
                                                        |
| 100 | - /**  | 
                                                        |
| 101 | - * EE_Dependency_Map constructor.  | 
                                                        |
| 102 | - *  | 
                                                        |
| 103 | - * @param ClassInterfaceCache $class_cache  | 
                                                        |
| 104 | - */  | 
                                                        |
| 105 | - protected function __construct(ClassInterfaceCache $class_cache)  | 
                                                        |
| 106 | -    { | 
                                                        |
| 107 | - $this->class_cache = $class_cache;  | 
                                                        |
| 108 | -        do_action('EE_Dependency_Map____construct', $this); | 
                                                        |
| 109 | - }  | 
                                                        |
| 110 | -  | 
                                                        |
| 111 | -  | 
                                                        |
| 112 | - /**  | 
                                                        |
| 113 | - * @return void  | 
                                                        |
| 114 | - */  | 
                                                        |
| 115 | - public function initialize()  | 
                                                        |
| 116 | -    { | 
                                                        |
| 117 | - $this->_register_core_dependencies();  | 
                                                        |
| 118 | - $this->_register_core_class_loaders();  | 
                                                        |
| 119 | - $this->_register_core_aliases();  | 
                                                        |
| 120 | - }  | 
                                                        |
| 121 | -  | 
                                                        |
| 122 | -  | 
                                                        |
| 123 | - /**  | 
                                                        |
| 124 | - * @singleton method used to instantiate class object  | 
                                                        |
| 125 | - * @param ClassInterfaceCache|null $class_cache  | 
                                                        |
| 126 | - * @return EE_Dependency_Map  | 
                                                        |
| 127 | - */  | 
                                                        |
| 128 | -    public static function instance(ClassInterfaceCache $class_cache = null) { | 
                                                        |
| 129 | - // check if class object is instantiated, and instantiated properly  | 
                                                        |
| 130 | - if (  | 
                                                        |
| 131 | - ! self::$_instance instanceof EE_Dependency_Map  | 
                                                        |
| 132 | - && $class_cache instanceof ClassInterfaceCache  | 
                                                        |
| 133 | -        ) { | 
                                                        |
| 134 | - self::$_instance = new EE_Dependency_Map($class_cache);  | 
                                                        |
| 135 | - }  | 
                                                        |
| 136 | - return self::$_instance;  | 
                                                        |
| 137 | - }  | 
                                                        |
| 138 | -  | 
                                                        |
| 139 | -  | 
                                                        |
| 140 | - /**  | 
                                                        |
| 141 | - * @param RequestInterface $request  | 
                                                        |
| 142 | - */  | 
                                                        |
| 143 | - public function setRequest(RequestInterface $request)  | 
                                                        |
| 144 | -    { | 
                                                        |
| 145 | - $this->request = $request;  | 
                                                        |
| 146 | - }  | 
                                                        |
| 147 | -  | 
                                                        |
| 148 | -  | 
                                                        |
| 149 | - /**  | 
                                                        |
| 150 | - * @param LegacyRequestInterface $legacy_request  | 
                                                        |
| 151 | - */  | 
                                                        |
| 152 | - public function setLegacyRequest(LegacyRequestInterface $legacy_request)  | 
                                                        |
| 153 | -    { | 
                                                        |
| 154 | - $this->legacy_request = $legacy_request;  | 
                                                        |
| 155 | - }  | 
                                                        |
| 156 | -  | 
                                                        |
| 157 | -  | 
                                                        |
| 158 | - /**  | 
                                                        |
| 159 | - * @param ResponseInterface $response  | 
                                                        |
| 160 | - */  | 
                                                        |
| 161 | - public function setResponse(ResponseInterface $response)  | 
                                                        |
| 162 | -    { | 
                                                        |
| 163 | - $this->response = $response;  | 
                                                        |
| 164 | - }  | 
                                                        |
| 165 | -  | 
                                                        |
| 166 | -  | 
                                                        |
| 167 | -  | 
                                                        |
| 168 | - /**  | 
                                                        |
| 169 | - * @param LoaderInterface $loader  | 
                                                        |
| 170 | - */  | 
                                                        |
| 171 | - public function setLoader(LoaderInterface $loader)  | 
                                                        |
| 172 | -    { | 
                                                        |
| 173 | - $this->loader = $loader;  | 
                                                        |
| 174 | - }  | 
                                                        |
| 175 | -  | 
                                                        |
| 176 | -  | 
                                                        |
| 177 | -  | 
                                                        |
| 178 | - /**  | 
                                                        |
| 179 | - * @param string $class  | 
                                                        |
| 180 | - * @param array $dependencies  | 
                                                        |
| 181 | - * @param int $overwrite  | 
                                                        |
| 182 | - * @return bool  | 
                                                        |
| 183 | - */  | 
                                                        |
| 184 | - public static function register_dependencies(  | 
                                                        |
| 185 | - $class,  | 
                                                        |
| 186 | - array $dependencies,  | 
                                                        |
| 187 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES  | 
                                                        |
| 188 | -    ) { | 
                                                        |
| 189 | - return self::$_instance->registerDependencies($class, $dependencies, $overwrite);  | 
                                                        |
| 190 | - }  | 
                                                        |
| 191 | -  | 
                                                        |
| 192 | -  | 
                                                        |
| 193 | -  | 
                                                        |
| 194 | - /**  | 
                                                        |
| 195 | - * Assigns an array of class names and corresponding load sources (new or cached)  | 
                                                        |
| 196 | - * to the class specified by the first parameter.  | 
                                                        |
| 197 | - * IMPORTANT !!!  | 
                                                        |
| 198 | - * The order of elements in the incoming $dependencies array MUST match  | 
                                                        |
| 199 | - * the order of the constructor parameters for the class in question.  | 
                                                        |
| 200 | - * This is especially important when overriding any existing dependencies that are registered.  | 
                                                        |
| 201 | - * the third parameter controls whether any duplicate dependencies are overwritten or not.  | 
                                                        |
| 202 | - *  | 
                                                        |
| 203 | - * @param string $class  | 
                                                        |
| 204 | - * @param array $dependencies  | 
                                                        |
| 205 | - * @param int $overwrite  | 
                                                        |
| 206 | - * @return bool  | 
                                                        |
| 207 | - */  | 
                                                        |
| 208 | - public function registerDependencies(  | 
                                                        |
| 209 | - $class,  | 
                                                        |
| 210 | - array $dependencies,  | 
                                                        |
| 211 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES  | 
                                                        |
| 212 | -    ) { | 
                                                        |
| 213 | - $class = trim($class, '\\');  | 
                                                        |
| 214 | - $registered = false;  | 
                                                        |
| 215 | -        if (empty(self::$_instance->_dependency_map[ $class ])) { | 
                                                        |
| 216 | - self::$_instance->_dependency_map[ $class ] = array();  | 
                                                        |
| 217 | - }  | 
                                                        |
| 218 | - // we need to make sure that any aliases used when registering a dependency  | 
                                                        |
| 219 | - // get resolved to the correct class name  | 
                                                        |
| 220 | -        foreach ($dependencies as $dependency => $load_source) { | 
                                                        |
| 221 | - $alias = self::$_instance->get_alias($dependency);  | 
                                                        |
| 222 | - if (  | 
                                                        |
| 223 | - $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES  | 
                                                        |
| 224 | - || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ])  | 
                                                        |
| 225 | -            ) { | 
                                                        |
| 226 | - unset($dependencies[$dependency]);  | 
                                                        |
| 227 | - $dependencies[$alias] = $load_source;  | 
                                                        |
| 228 | - $registered = true;  | 
                                                        |
| 229 | - }  | 
                                                        |
| 230 | - }  | 
                                                        |
| 231 | - // now add our two lists of dependencies together.  | 
                                                        |
| 232 | - // using Union (+=) favours the arrays in precedence from left to right,  | 
                                                        |
| 233 | - // so $dependencies is NOT overwritten because it is listed first  | 
                                                        |
| 234 | - // ie: with A = B + C, entries in B take precedence over duplicate entries in C  | 
                                                        |
| 235 | - // Union is way faster than array_merge() but should be used with caution...  | 
                                                        |
| 236 | - // especially with numerically indexed arrays  | 
                                                        |
| 237 | - $dependencies += self::$_instance->_dependency_map[ $class ];  | 
                                                        |
| 238 | - // now we need to ensure that the resulting dependencies  | 
                                                        |
| 239 | - // array only has the entries that are required for the class  | 
                                                        |
| 240 | - // so first count how many dependencies were originally registered for the class  | 
                                                        |
| 241 | - $dependency_count = count(self::$_instance->_dependency_map[ $class ]);  | 
                                                        |
| 242 | - // if that count is non-zero (meaning dependencies were already registered)  | 
                                                        |
| 243 | - self::$_instance->_dependency_map[ $class ] = $dependency_count  | 
                                                        |
| 244 | - // then truncate the final array to match that count  | 
                                                        |
| 245 | - ? array_slice($dependencies, 0, $dependency_count)  | 
                                                        |
| 246 | - // otherwise just take the incoming array because nothing previously existed  | 
                                                        |
| 247 | - : $dependencies;  | 
                                                        |
| 248 | - return $registered;  | 
                                                        |
| 249 | - }  | 
                                                        |
| 250 | -  | 
                                                        |
| 251 | -  | 
                                                        |
| 252 | -  | 
                                                        |
| 253 | - /**  | 
                                                        |
| 254 | - * @param string $class_name  | 
                                                        |
| 255 | - * @param string $loader  | 
                                                        |
| 256 | - * @return bool  | 
                                                        |
| 257 | - * @throws DomainException  | 
                                                        |
| 258 | - */  | 
                                                        |
| 259 | - public static function register_class_loader($class_name, $loader = 'load_core')  | 
                                                        |
| 260 | -    { | 
                                                        |
| 261 | -        if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { | 
                                                        |
| 262 | - throw new DomainException(  | 
                                                        |
| 263 | -                esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') | 
                                                        |
| 264 | - );  | 
                                                        |
| 265 | - }  | 
                                                        |
| 266 | - // check that loader is callable or method starts with "load_" and exists in EE_Registry  | 
                                                        |
| 267 | - if (  | 
                                                        |
| 268 | - ! is_callable($loader)  | 
                                                        |
| 269 | - && (  | 
                                                        |
| 270 | - strpos($loader, 'load_') !== 0  | 
                                                        |
| 271 | -                || ! method_exists('EE_Registry', $loader) | 
                                                        |
| 272 | - )  | 
                                                        |
| 273 | -        ) { | 
                                                        |
| 274 | - throw new DomainException(  | 
                                                        |
| 275 | - sprintf(  | 
                                                        |
| 276 | - esc_html__(  | 
                                                        |
| 277 | - '"%1$s" is not a valid loader method on EE_Registry.',  | 
                                                        |
| 278 | - 'event_espresso'  | 
                                                        |
| 279 | - ),  | 
                                                        |
| 280 | - $loader  | 
                                                        |
| 281 | - )  | 
                                                        |
| 282 | - );  | 
                                                        |
| 283 | - }  | 
                                                        |
| 284 | - $class_name = self::$_instance->get_alias($class_name);  | 
                                                        |
| 285 | -        if (! isset(self::$_instance->_class_loaders[$class_name])) { | 
                                                        |
| 286 | - self::$_instance->_class_loaders[$class_name] = $loader;  | 
                                                        |
| 287 | - return true;  | 
                                                        |
| 288 | - }  | 
                                                        |
| 289 | - return false;  | 
                                                        |
| 290 | - }  | 
                                                        |
| 291 | -  | 
                                                        |
| 292 | -  | 
                                                        |
| 293 | -  | 
                                                        |
| 294 | - /**  | 
                                                        |
| 295 | - * @return array  | 
                                                        |
| 296 | - */  | 
                                                        |
| 297 | - public function dependency_map()  | 
                                                        |
| 298 | -    { | 
                                                        |
| 299 | - return $this->_dependency_map;  | 
                                                        |
| 300 | - }  | 
                                                        |
| 301 | -  | 
                                                        |
| 302 | -  | 
                                                        |
| 303 | -  | 
                                                        |
| 304 | - /**  | 
                                                        |
| 305 | - * returns TRUE if dependency map contains a listing for the provided class name  | 
                                                        |
| 306 | - *  | 
                                                        |
| 307 | - * @param string $class_name  | 
                                                        |
| 308 | - * @return boolean  | 
                                                        |
| 309 | - */  | 
                                                        |
| 310 | - public function has($class_name = '')  | 
                                                        |
| 311 | -    { | 
                                                        |
| 312 | - // all legacy models have the same dependencies  | 
                                                        |
| 313 | -        if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 314 | - $class_name = 'LEGACY_MODELS';  | 
                                                        |
| 315 | - }  | 
                                                        |
| 316 | - return isset($this->_dependency_map[$class_name]) ? true : false;  | 
                                                        |
| 317 | - }  | 
                                                        |
| 318 | -  | 
                                                        |
| 319 | -  | 
                                                        |
| 320 | -  | 
                                                        |
| 321 | - /**  | 
                                                        |
| 322 | - * returns TRUE if dependency map contains a listing for the provided class name AND dependency  | 
                                                        |
| 323 | - *  | 
                                                        |
| 324 | - * @param string $class_name  | 
                                                        |
| 325 | - * @param string $dependency  | 
                                                        |
| 326 | - * @return bool  | 
                                                        |
| 327 | - */  | 
                                                        |
| 328 | - public function has_dependency_for_class($class_name = '', $dependency = '')  | 
                                                        |
| 329 | -    { | 
                                                        |
| 330 | - // all legacy models have the same dependencies  | 
                                                        |
| 331 | -        if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 332 | - $class_name = 'LEGACY_MODELS';  | 
                                                        |
| 333 | - }  | 
                                                        |
| 334 | - $dependency = $this->get_alias($dependency);  | 
                                                        |
| 335 | - return isset($this->_dependency_map[$class_name][$dependency])  | 
                                                        |
| 336 | - ? true  | 
                                                        |
| 337 | - : false;  | 
                                                        |
| 338 | - }  | 
                                                        |
| 339 | -  | 
                                                        |
| 340 | -  | 
                                                        |
| 341 | -  | 
                                                        |
| 342 | - /**  | 
                                                        |
| 343 | - * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned  | 
                                                        |
| 344 | - *  | 
                                                        |
| 345 | - * @param string $class_name  | 
                                                        |
| 346 | - * @param string $dependency  | 
                                                        |
| 347 | - * @return int  | 
                                                        |
| 348 | - */  | 
                                                        |
| 349 | - public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')  | 
                                                        |
| 350 | -    { | 
                                                        |
| 351 | - // all legacy models have the same dependencies  | 
                                                        |
| 352 | -        if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 353 | - $class_name = 'LEGACY_MODELS';  | 
                                                        |
| 354 | - }  | 
                                                        |
| 355 | - $dependency = $this->get_alias($dependency);  | 
                                                        |
| 356 | - return $this->has_dependency_for_class($class_name, $dependency)  | 
                                                        |
| 357 | - ? $this->_dependency_map[$class_name][$dependency]  | 
                                                        |
| 358 | - : EE_Dependency_Map::not_registered;  | 
                                                        |
| 359 | - }  | 
                                                        |
| 360 | -  | 
                                                        |
| 361 | -  | 
                                                        |
| 362 | -  | 
                                                        |
| 363 | - /**  | 
                                                        |
| 364 | - * @param string $class_name  | 
                                                        |
| 365 | - * @return string | Closure  | 
                                                        |
| 366 | - */  | 
                                                        |
| 367 | - public function class_loader($class_name)  | 
                                                        |
| 368 | -    { | 
                                                        |
| 369 | - // all legacy models use load_model()  | 
                                                        |
| 370 | -        if(strpos($class_name, 'EEM_') === 0){ | 
                                                        |
| 371 | - return 'load_model';  | 
                                                        |
| 372 | - }  | 
                                                        |
| 373 | - $class_name = $this->get_alias($class_name);  | 
                                                        |
| 374 | - return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : '';  | 
                                                        |
| 375 | - }  | 
                                                        |
| 376 | -  | 
                                                        |
| 377 | -  | 
                                                        |
| 378 | -  | 
                                                        |
| 379 | - /**  | 
                                                        |
| 380 | - * @return array  | 
                                                        |
| 381 | - */  | 
                                                        |
| 382 | - public function class_loaders()  | 
                                                        |
| 383 | -    { | 
                                                        |
| 384 | - return $this->_class_loaders;  | 
                                                        |
| 385 | - }  | 
                                                        |
| 386 | -  | 
                                                        |
| 387 | -  | 
                                                        |
| 388 | -  | 
                                                        |
| 389 | - /**  | 
                                                        |
| 390 | - * adds an alias for a classname  | 
                                                        |
| 391 | - *  | 
                                                        |
| 392 | - * @param string $fqcn the class name that should be used (concrete class to replace interface)  | 
                                                        |
| 393 | - * @param string $alias the class name that would be type hinted for (abstract parent or interface)  | 
                                                        |
| 394 | - * @param string $for_class the class that has the dependency (is type hinting for the interface)  | 
                                                        |
| 395 | - */  | 
                                                        |
| 396 | - public function add_alias($fqcn, $alias, $for_class = '')  | 
                                                        |
| 397 | -    { | 
                                                        |
| 398 | - $this->class_cache->addAlias($alias, $fqcn, $for_class);  | 
                                                        |
| 399 | - }  | 
                                                        |
| 400 | -  | 
                                                        |
| 401 | -  | 
                                                        |
| 402 | -  | 
                                                        |
| 403 | - /**  | 
                                                        |
| 404 | - * PLZ NOTE: a better name for this method would be is_alias()  | 
                                                        |
| 405 | - * because it returns TRUE if the provided fully qualified name IS an alias  | 
                                                        |
| 406 | - *  | 
                                                        |
| 407 | - * @param string $fqn  | 
                                                        |
| 408 | - * @param string $for_class  | 
                                                        |
| 409 | - * @return bool  | 
                                                        |
| 410 | - */  | 
                                                        |
| 411 | - public function has_alias($fqn = '', $for_class = '')  | 
                                                        |
| 412 | -    { | 
                                                        |
| 413 | - return $this->class_cache->isAlias($fqn, $for_class);  | 
                                                        |
| 414 | - }  | 
                                                        |
| 415 | -  | 
                                                        |
| 416 | -  | 
                                                        |
| 417 | -  | 
                                                        |
| 418 | - /**  | 
                                                        |
| 419 | - * PLZ NOTE: a better name for this method would be get_fqn_for_alias()  | 
                                                        |
| 420 | - * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias  | 
                                                        |
| 421 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN  | 
                                                        |
| 422 | - * for example:  | 
                                                        |
| 423 | - * if the following two entries were added to the _aliases array:  | 
                                                        |
| 424 | - * array(  | 
                                                        |
| 425 | - * 'interface_alias' => 'some\namespace\interface'  | 
                                                        |
| 426 | - * 'some\namespace\interface' => 'some\namespace\classname'  | 
                                                        |
| 427 | - * )  | 
                                                        |
| 428 | - * then one could use EE_Registry::instance()->create( 'interface_alias' )  | 
                                                        |
| 429 | - * to load an instance of 'some\namespace\classname'  | 
                                                        |
| 430 | - *  | 
                                                        |
| 431 | - * @param string $alias  | 
                                                        |
| 432 | - * @param string $for_class  | 
                                                        |
| 433 | - * @return string  | 
                                                        |
| 434 | - */  | 
                                                        |
| 435 | - public function get_alias($alias = '', $for_class = '')  | 
                                                        |
| 436 | -    { | 
                                                        |
| 437 | - return (string) $this->class_cache->getFqnForAlias($alias, $for_class);  | 
                                                        |
| 438 | - }  | 
                                                        |
| 439 | -  | 
                                                        |
| 440 | -  | 
                                                        |
| 441 | -  | 
                                                        |
| 442 | - /**  | 
                                                        |
| 443 | - * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,  | 
                                                        |
| 444 | - * if one exists, or whether a new object should be generated every time the requested class is loaded.  | 
                                                        |
| 445 | - * This is done by using the following class constants:  | 
                                                        |
| 446 | - * EE_Dependency_Map::load_from_cache - loads previously instantiated object  | 
                                                        |
| 447 | - * EE_Dependency_Map::load_new_object - generates a new object every time  | 
                                                        |
| 448 | - */  | 
                                                        |
| 449 | - protected function _register_core_dependencies()  | 
                                                        |
| 450 | -    { | 
                                                        |
| 451 | - $this->_dependency_map = array(  | 
                                                        |
| 452 | - 'EE_Request_Handler' => array(  | 
                                                        |
| 453 | - 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 454 | - ),  | 
                                                        |
| 455 | - 'EE_System' => array(  | 
                                                        |
| 456 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 457 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 458 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 459 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 460 | - ),  | 
                                                        |
| 461 | - 'EE_Session' => array(  | 
                                                        |
| 462 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 463 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 464 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 465 | - 'EE_Encryption' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 466 | - ),  | 
                                                        |
| 467 | - 'EE_Cart' => array(  | 
                                                        |
| 468 | - 'EE_Session' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 469 | - ),  | 
                                                        |
| 470 | - 'EE_Front_Controller' => array(  | 
                                                        |
| 471 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 472 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 473 | - 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 474 | - ),  | 
                                                        |
| 475 | - 'EE_Messenger_Collection_Loader' => array(  | 
                                                        |
| 476 | - 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 477 | - ),  | 
                                                        |
| 478 | - 'EE_Message_Type_Collection_Loader' => array(  | 
                                                        |
| 479 | - 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 480 | - ),  | 
                                                        |
| 481 | - 'EE_Message_Resource_Manager' => array(  | 
                                                        |
| 482 | - 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 483 | - 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 484 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 485 | - ),  | 
                                                        |
| 486 | - 'EE_Message_Factory' => array(  | 
                                                        |
| 487 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 488 | - ),  | 
                                                        |
| 489 | - 'EE_messages' => array(  | 
                                                        |
| 490 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 491 | - ),  | 
                                                        |
| 492 | - 'EE_Messages_Generator' => array(  | 
                                                        |
| 493 | - 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 494 | - 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 495 | - 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 496 | - 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 497 | - ),  | 
                                                        |
| 498 | - 'EE_Messages_Processor' => array(  | 
                                                        |
| 499 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 500 | - ),  | 
                                                        |
| 501 | - 'EE_Messages_Queue' => array(  | 
                                                        |
| 502 | - 'EE_Message_Repository' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 503 | - ),  | 
                                                        |
| 504 | - 'EE_Messages_Template_Defaults' => array(  | 
                                                        |
| 505 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 506 | - 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 507 | - ),  | 
                                                        |
| 508 | - 'EE_Message_To_Generate_From_Request' => array(  | 
                                                        |
| 509 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 510 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 511 | - ),  | 
                                                        |
| 512 | - 'EventEspresso\core\services\commands\CommandBus' => array(  | 
                                                        |
| 513 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 514 | - ),  | 
                                                        |
| 515 | - 'EventEspresso\services\commands\CommandHandler' => array(  | 
                                                        |
| 516 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 517 | - 'CommandBusInterface' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 518 | - ),  | 
                                                        |
| 519 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => array(  | 
                                                        |
| 520 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 521 | - ),  | 
                                                        |
| 522 | - 'EventEspresso\core\services\commands\CompositeCommandHandler' => array(  | 
                                                        |
| 523 | - 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 524 | - 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 525 | - ),  | 
                                                        |
| 526 | - 'EventEspresso\core\services\commands\CommandFactory' => array(  | 
                                                        |
| 527 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 528 | - ),  | 
                                                        |
| 529 | - 'EventEspresso\core\services\commands\middleware\CapChecker' => array(  | 
                                                        |
| 530 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 531 | - ),  | 
                                                        |
| 532 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => array(  | 
                                                        |
| 533 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 534 | - ),  | 
                                                        |
| 535 | - 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => array(  | 
                                                        |
| 536 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 537 | - ),  | 
                                                        |
| 538 | - 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => array(  | 
                                                        |
| 539 | - 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 540 | - ),  | 
                                                        |
| 541 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => array(  | 
                                                        |
| 542 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 543 | - ),  | 
                                                        |
| 544 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => array(  | 
                                                        |
| 545 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 546 | - ),  | 
                                                        |
| 547 | - 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => array(  | 
                                                        |
| 548 | - 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 549 | - ),  | 
                                                        |
| 550 | - 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array(  | 
                                                        |
| 551 | - 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 552 | - ),  | 
                                                        |
| 553 | - 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => array(  | 
                                                        |
| 554 | - 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 555 | - ),  | 
                                                        |
| 556 | - 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => array(  | 
                                                        |
| 557 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 558 | - ),  | 
                                                        |
| 559 | - 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => array(  | 
                                                        |
| 560 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 561 | - ),  | 
                                                        |
| 562 | - 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => array(  | 
                                                        |
| 563 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 564 | - ),  | 
                                                        |
| 565 | - 'EventEspresso\core\services\database\TableManager' => array(  | 
                                                        |
| 566 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 567 | - ),  | 
                                                        |
| 568 | - 'EE_Data_Migration_Class_Base' => array(  | 
                                                        |
| 569 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 570 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 571 | - ),  | 
                                                        |
| 572 | - 'EE_DMS_Core_4_1_0' => array(  | 
                                                        |
| 573 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 574 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 575 | - ),  | 
                                                        |
| 576 | - 'EE_DMS_Core_4_2_0' => array(  | 
                                                        |
| 577 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 578 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 579 | - ),  | 
                                                        |
| 580 | - 'EE_DMS_Core_4_3_0' => array(  | 
                                                        |
| 581 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 582 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 583 | - ),  | 
                                                        |
| 584 | - 'EE_DMS_Core_4_4_0' => array(  | 
                                                        |
| 585 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 586 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 587 | - ),  | 
                                                        |
| 588 | - 'EE_DMS_Core_4_5_0' => array(  | 
                                                        |
| 589 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 590 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 591 | - ),  | 
                                                        |
| 592 | - 'EE_DMS_Core_4_6_0' => array(  | 
                                                        |
| 593 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 594 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 595 | - ),  | 
                                                        |
| 596 | - 'EE_DMS_Core_4_7_0' => array(  | 
                                                        |
| 597 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 598 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 599 | - ),  | 
                                                        |
| 600 | - 'EE_DMS_Core_4_8_0' => array(  | 
                                                        |
| 601 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 602 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 603 | - ),  | 
                                                        |
| 604 | - 'EE_DMS_Core_4_9_0' => array(  | 
                                                        |
| 605 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 606 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 607 | - ),  | 
                                                        |
| 608 | - 'EventEspresso\core\services\assets\I18nRegistry' => array(  | 
                                                        |
| 609 | - array(),  | 
                                                        |
| 610 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 611 | - ),  | 
                                                        |
| 612 | - 'EventEspresso\core\services\assets\Registry' => array(  | 
                                                        |
| 613 | - 'EE_Template_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 614 | - 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 615 | - 'EventEspresso\core\services\assets\I18nRegistry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 616 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 617 | - ),  | 
                                                        |
| 618 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => array(  | 
                                                        |
| 619 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 620 | - ),  | 
                                                        |
| 621 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => array(  | 
                                                        |
| 622 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 623 | - ),  | 
                                                        |
| 624 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => array(  | 
                                                        |
| 625 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 626 | - ),  | 
                                                        |
| 627 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => array(  | 
                                                        |
| 628 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 629 | - ),  | 
                                                        |
| 630 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => array(  | 
                                                        |
| 631 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 632 | - ),  | 
                                                        |
| 633 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => array(  | 
                                                        |
| 634 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 635 | - ),  | 
                                                        |
| 636 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => array(  | 
                                                        |
| 637 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 638 | - ),  | 
                                                        |
| 639 | - 'EventEspresso\core\services\cache\BasicCacheManager' => array(  | 
                                                        |
| 640 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 641 | - ),  | 
                                                        |
| 642 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => array(  | 
                                                        |
| 643 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 644 | - ),  | 
                                                        |
| 645 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => array(  | 
                                                        |
| 646 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 647 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 648 | - ),  | 
                                                        |
| 649 | - 'EventEspresso\core\domain\values\EmailAddress' => array(  | 
                                                        |
| 650 | - null,  | 
                                                        |
| 651 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 652 | - ),  | 
                                                        |
| 653 | - 'EventEspresso\core\services\orm\ModelFieldFactory' => array(  | 
                                                        |
| 654 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 655 | - ),  | 
                                                        |
| 656 | - 'LEGACY_MODELS' => array(  | 
                                                        |
| 657 | - null,  | 
                                                        |
| 658 | - 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 659 | - ),  | 
                                                        |
| 660 | - 'EE_Module_Request_Router' => array(  | 
                                                        |
| 661 | - 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 662 | - ),  | 
                                                        |
| 663 | - 'EE_Registration_Processor' => array(  | 
                                                        |
| 664 | - 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 665 | - ),  | 
                                                        |
| 666 | - 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => array(  | 
                                                        |
| 667 | - null,  | 
                                                        |
| 668 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 669 | - 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 670 | - ),  | 
                                                        |
| 671 | - 'EventEspresso\core\services\licensing\LicenseService' => array(  | 
                                                        |
| 672 | - 'EventEspresso\core\domain\services\pue\Stats' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 673 | - 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 674 | - ),  | 
                                                        |
| 28 | + /**  | 
                                                        |
| 29 | + * This means that the requested class dependency is not present in the dependency map  | 
                                                        |
| 30 | + */  | 
                                                        |
| 31 | + const not_registered = 0;  | 
                                                        |
| 32 | +  | 
                                                        |
| 33 | + /**  | 
                                                        |
| 34 | + * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class.  | 
                                                        |
| 35 | + */  | 
                                                        |
| 36 | + const load_new_object = 1;  | 
                                                        |
| 37 | +  | 
                                                        |
| 38 | + /**  | 
                                                        |
| 39 | + * This instructs class loaders to return a previously instantiated and cached object for the requested class.  | 
                                                        |
| 40 | + * IF a previously instantiated object does not exist, a new one will be created and added to the cache.  | 
                                                        |
| 41 | + */  | 
                                                        |
| 42 | + const load_from_cache = 2;  | 
                                                        |
| 43 | +  | 
                                                        |
| 44 | + /**  | 
                                                        |
| 45 | + * When registering a dependency,  | 
                                                        |
| 46 | + * this indicates to keep any existing dependencies that already exist,  | 
                                                        |
| 47 | + * and simply discard any new dependencies declared in the incoming data  | 
                                                        |
| 48 | + */  | 
                                                        |
| 49 | + const KEEP_EXISTING_DEPENDENCIES = 0;  | 
                                                        |
| 50 | +  | 
                                                        |
| 51 | + /**  | 
                                                        |
| 52 | + * When registering a dependency,  | 
                                                        |
| 53 | + * this indicates to overwrite any existing dependencies that already exist using the incoming data  | 
                                                        |
| 54 | + */  | 
                                                        |
| 55 | + const OVERWRITE_DEPENDENCIES = 1;  | 
                                                        |
| 56 | +  | 
                                                        |
| 57 | +  | 
                                                        |
| 58 | +  | 
                                                        |
| 59 | + /**  | 
                                                        |
| 60 | + * @type EE_Dependency_Map $_instance  | 
                                                        |
| 61 | + */  | 
                                                        |
| 62 | + protected static $_instance;  | 
                                                        |
| 63 | +  | 
                                                        |
| 64 | + /**  | 
                                                        |
| 65 | + * @var ClassInterfaceCache $class_cache  | 
                                                        |
| 66 | + */  | 
                                                        |
| 67 | + private $class_cache;  | 
                                                        |
| 68 | +  | 
                                                        |
| 69 | + /**  | 
                                                        |
| 70 | + * @type RequestInterface $request  | 
                                                        |
| 71 | + */  | 
                                                        |
| 72 | + protected $request;  | 
                                                        |
| 73 | +  | 
                                                        |
| 74 | + /**  | 
                                                        |
| 75 | + * @type LegacyRequestInterface $legacy_request  | 
                                                        |
| 76 | + */  | 
                                                        |
| 77 | + protected $legacy_request;  | 
                                                        |
| 78 | +  | 
                                                        |
| 79 | + /**  | 
                                                        |
| 80 | + * @type ResponseInterface $response  | 
                                                        |
| 81 | + */  | 
                                                        |
| 82 | + protected $response;  | 
                                                        |
| 83 | +  | 
                                                        |
| 84 | + /**  | 
                                                        |
| 85 | + * @type LoaderInterface $loader  | 
                                                        |
| 86 | + */  | 
                                                        |
| 87 | + protected $loader;  | 
                                                        |
| 88 | +  | 
                                                        |
| 89 | + /**  | 
                                                        |
| 90 | + * @type array $_dependency_map  | 
                                                        |
| 91 | + */  | 
                                                        |
| 92 | + protected $_dependency_map = array();  | 
                                                        |
| 93 | +  | 
                                                        |
| 94 | + /**  | 
                                                        |
| 95 | + * @type array $_class_loaders  | 
                                                        |
| 96 | + */  | 
                                                        |
| 97 | + protected $_class_loaders = array();  | 
                                                        |
| 98 | +  | 
                                                        |
| 99 | +  | 
                                                        |
| 100 | + /**  | 
                                                        |
| 101 | + * EE_Dependency_Map constructor.  | 
                                                        |
| 102 | + *  | 
                                                        |
| 103 | + * @param ClassInterfaceCache $class_cache  | 
                                                        |
| 104 | + */  | 
                                                        |
| 105 | + protected function __construct(ClassInterfaceCache $class_cache)  | 
                                                        |
| 106 | +	{ | 
                                                        |
| 107 | + $this->class_cache = $class_cache;  | 
                                                        |
| 108 | +		do_action('EE_Dependency_Map____construct', $this); | 
                                                        |
| 109 | + }  | 
                                                        |
| 110 | +  | 
                                                        |
| 111 | +  | 
                                                        |
| 112 | + /**  | 
                                                        |
| 113 | + * @return void  | 
                                                        |
| 114 | + */  | 
                                                        |
| 115 | + public function initialize()  | 
                                                        |
| 116 | +	{ | 
                                                        |
| 117 | + $this->_register_core_dependencies();  | 
                                                        |
| 118 | + $this->_register_core_class_loaders();  | 
                                                        |
| 119 | + $this->_register_core_aliases();  | 
                                                        |
| 120 | + }  | 
                                                        |
| 121 | +  | 
                                                        |
| 122 | +  | 
                                                        |
| 123 | + /**  | 
                                                        |
| 124 | + * @singleton method used to instantiate class object  | 
                                                        |
| 125 | + * @param ClassInterfaceCache|null $class_cache  | 
                                                        |
| 126 | + * @return EE_Dependency_Map  | 
                                                        |
| 127 | + */  | 
                                                        |
| 128 | +	public static function instance(ClassInterfaceCache $class_cache = null) { | 
                                                        |
| 129 | + // check if class object is instantiated, and instantiated properly  | 
                                                        |
| 130 | + if (  | 
                                                        |
| 131 | + ! self::$_instance instanceof EE_Dependency_Map  | 
                                                        |
| 132 | + && $class_cache instanceof ClassInterfaceCache  | 
                                                        |
| 133 | +		) { | 
                                                        |
| 134 | + self::$_instance = new EE_Dependency_Map($class_cache);  | 
                                                        |
| 135 | + }  | 
                                                        |
| 136 | + return self::$_instance;  | 
                                                        |
| 137 | + }  | 
                                                        |
| 138 | +  | 
                                                        |
| 139 | +  | 
                                                        |
| 140 | + /**  | 
                                                        |
| 141 | + * @param RequestInterface $request  | 
                                                        |
| 142 | + */  | 
                                                        |
| 143 | + public function setRequest(RequestInterface $request)  | 
                                                        |
| 144 | +	{ | 
                                                        |
| 145 | + $this->request = $request;  | 
                                                        |
| 146 | + }  | 
                                                        |
| 147 | +  | 
                                                        |
| 148 | +  | 
                                                        |
| 149 | + /**  | 
                                                        |
| 150 | + * @param LegacyRequestInterface $legacy_request  | 
                                                        |
| 151 | + */  | 
                                                        |
| 152 | + public function setLegacyRequest(LegacyRequestInterface $legacy_request)  | 
                                                        |
| 153 | +	{ | 
                                                        |
| 154 | + $this->legacy_request = $legacy_request;  | 
                                                        |
| 155 | + }  | 
                                                        |
| 156 | +  | 
                                                        |
| 157 | +  | 
                                                        |
| 158 | + /**  | 
                                                        |
| 159 | + * @param ResponseInterface $response  | 
                                                        |
| 160 | + */  | 
                                                        |
| 161 | + public function setResponse(ResponseInterface $response)  | 
                                                        |
| 162 | +	{ | 
                                                        |
| 163 | + $this->response = $response;  | 
                                                        |
| 164 | + }  | 
                                                        |
| 165 | +  | 
                                                        |
| 166 | +  | 
                                                        |
| 167 | +  | 
                                                        |
| 168 | + /**  | 
                                                        |
| 169 | + * @param LoaderInterface $loader  | 
                                                        |
| 170 | + */  | 
                                                        |
| 171 | + public function setLoader(LoaderInterface $loader)  | 
                                                        |
| 172 | +	{ | 
                                                        |
| 173 | + $this->loader = $loader;  | 
                                                        |
| 174 | + }  | 
                                                        |
| 175 | +  | 
                                                        |
| 176 | +  | 
                                                        |
| 177 | +  | 
                                                        |
| 178 | + /**  | 
                                                        |
| 179 | + * @param string $class  | 
                                                        |
| 180 | + * @param array $dependencies  | 
                                                        |
| 181 | + * @param int $overwrite  | 
                                                        |
| 182 | + * @return bool  | 
                                                        |
| 183 | + */  | 
                                                        |
| 184 | + public static function register_dependencies(  | 
                                                        |
| 185 | + $class,  | 
                                                        |
| 186 | + array $dependencies,  | 
                                                        |
| 187 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES  | 
                                                        |
| 188 | +	) { | 
                                                        |
| 189 | + return self::$_instance->registerDependencies($class, $dependencies, $overwrite);  | 
                                                        |
| 190 | + }  | 
                                                        |
| 191 | +  | 
                                                        |
| 192 | +  | 
                                                        |
| 193 | +  | 
                                                        |
| 194 | + /**  | 
                                                        |
| 195 | + * Assigns an array of class names and corresponding load sources (new or cached)  | 
                                                        |
| 196 | + * to the class specified by the first parameter.  | 
                                                        |
| 197 | + * IMPORTANT !!!  | 
                                                        |
| 198 | + * The order of elements in the incoming $dependencies array MUST match  | 
                                                        |
| 199 | + * the order of the constructor parameters for the class in question.  | 
                                                        |
| 200 | + * This is especially important when overriding any existing dependencies that are registered.  | 
                                                        |
| 201 | + * the third parameter controls whether any duplicate dependencies are overwritten or not.  | 
                                                        |
| 202 | + *  | 
                                                        |
| 203 | + * @param string $class  | 
                                                        |
| 204 | + * @param array $dependencies  | 
                                                        |
| 205 | + * @param int $overwrite  | 
                                                        |
| 206 | + * @return bool  | 
                                                        |
| 207 | + */  | 
                                                        |
| 208 | + public function registerDependencies(  | 
                                                        |
| 209 | + $class,  | 
                                                        |
| 210 | + array $dependencies,  | 
                                                        |
| 211 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES  | 
                                                        |
| 212 | +	) { | 
                                                        |
| 213 | + $class = trim($class, '\\');  | 
                                                        |
| 214 | + $registered = false;  | 
                                                        |
| 215 | +		if (empty(self::$_instance->_dependency_map[ $class ])) { | 
                                                        |
| 216 | + self::$_instance->_dependency_map[ $class ] = array();  | 
                                                        |
| 217 | + }  | 
                                                        |
| 218 | + // we need to make sure that any aliases used when registering a dependency  | 
                                                        |
| 219 | + // get resolved to the correct class name  | 
                                                        |
| 220 | +		foreach ($dependencies as $dependency => $load_source) { | 
                                                        |
| 221 | + $alias = self::$_instance->get_alias($dependency);  | 
                                                        |
| 222 | + if (  | 
                                                        |
| 223 | + $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES  | 
                                                        |
| 224 | + || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ])  | 
                                                        |
| 225 | +			) { | 
                                                        |
| 226 | + unset($dependencies[$dependency]);  | 
                                                        |
| 227 | + $dependencies[$alias] = $load_source;  | 
                                                        |
| 228 | + $registered = true;  | 
                                                        |
| 229 | + }  | 
                                                        |
| 230 | + }  | 
                                                        |
| 231 | + // now add our two lists of dependencies together.  | 
                                                        |
| 232 | + // using Union (+=) favours the arrays in precedence from left to right,  | 
                                                        |
| 233 | + // so $dependencies is NOT overwritten because it is listed first  | 
                                                        |
| 234 | + // ie: with A = B + C, entries in B take precedence over duplicate entries in C  | 
                                                        |
| 235 | + // Union is way faster than array_merge() but should be used with caution...  | 
                                                        |
| 236 | + // especially with numerically indexed arrays  | 
                                                        |
| 237 | + $dependencies += self::$_instance->_dependency_map[ $class ];  | 
                                                        |
| 238 | + // now we need to ensure that the resulting dependencies  | 
                                                        |
| 239 | + // array only has the entries that are required for the class  | 
                                                        |
| 240 | + // so first count how many dependencies were originally registered for the class  | 
                                                        |
| 241 | + $dependency_count = count(self::$_instance->_dependency_map[ $class ]);  | 
                                                        |
| 242 | + // if that count is non-zero (meaning dependencies were already registered)  | 
                                                        |
| 243 | + self::$_instance->_dependency_map[ $class ] = $dependency_count  | 
                                                        |
| 244 | + // then truncate the final array to match that count  | 
                                                        |
| 245 | + ? array_slice($dependencies, 0, $dependency_count)  | 
                                                        |
| 246 | + // otherwise just take the incoming array because nothing previously existed  | 
                                                        |
| 247 | + : $dependencies;  | 
                                                        |
| 248 | + return $registered;  | 
                                                        |
| 249 | + }  | 
                                                        |
| 250 | +  | 
                                                        |
| 251 | +  | 
                                                        |
| 252 | +  | 
                                                        |
| 253 | + /**  | 
                                                        |
| 254 | + * @param string $class_name  | 
                                                        |
| 255 | + * @param string $loader  | 
                                                        |
| 256 | + * @return bool  | 
                                                        |
| 257 | + * @throws DomainException  | 
                                                        |
| 258 | + */  | 
                                                        |
| 259 | + public static function register_class_loader($class_name, $loader = 'load_core')  | 
                                                        |
| 260 | +	{ | 
                                                        |
| 261 | +		if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { | 
                                                        |
| 262 | + throw new DomainException(  | 
                                                        |
| 263 | +				esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') | 
                                                        |
| 264 | + );  | 
                                                        |
| 265 | + }  | 
                                                        |
| 266 | + // check that loader is callable or method starts with "load_" and exists in EE_Registry  | 
                                                        |
| 267 | + if (  | 
                                                        |
| 268 | + ! is_callable($loader)  | 
                                                        |
| 269 | + && (  | 
                                                        |
| 270 | + strpos($loader, 'load_') !== 0  | 
                                                        |
| 271 | +				|| ! method_exists('EE_Registry', $loader) | 
                                                        |
| 272 | + )  | 
                                                        |
| 273 | +		) { | 
                                                        |
| 274 | + throw new DomainException(  | 
                                                        |
| 275 | + sprintf(  | 
                                                        |
| 276 | + esc_html__(  | 
                                                        |
| 277 | + '"%1$s" is not a valid loader method on EE_Registry.',  | 
                                                        |
| 278 | + 'event_espresso'  | 
                                                        |
| 279 | + ),  | 
                                                        |
| 280 | + $loader  | 
                                                        |
| 281 | + )  | 
                                                        |
| 282 | + );  | 
                                                        |
| 283 | + }  | 
                                                        |
| 284 | + $class_name = self::$_instance->get_alias($class_name);  | 
                                                        |
| 285 | +		if (! isset(self::$_instance->_class_loaders[$class_name])) { | 
                                                        |
| 286 | + self::$_instance->_class_loaders[$class_name] = $loader;  | 
                                                        |
| 287 | + return true;  | 
                                                        |
| 288 | + }  | 
                                                        |
| 289 | + return false;  | 
                                                        |
| 290 | + }  | 
                                                        |
| 291 | +  | 
                                                        |
| 292 | +  | 
                                                        |
| 293 | +  | 
                                                        |
| 294 | + /**  | 
                                                        |
| 295 | + * @return array  | 
                                                        |
| 296 | + */  | 
                                                        |
| 297 | + public function dependency_map()  | 
                                                        |
| 298 | +	{ | 
                                                        |
| 299 | + return $this->_dependency_map;  | 
                                                        |
| 300 | + }  | 
                                                        |
| 301 | +  | 
                                                        |
| 302 | +  | 
                                                        |
| 303 | +  | 
                                                        |
| 304 | + /**  | 
                                                        |
| 305 | + * returns TRUE if dependency map contains a listing for the provided class name  | 
                                                        |
| 306 | + *  | 
                                                        |
| 307 | + * @param string $class_name  | 
                                                        |
| 308 | + * @return boolean  | 
                                                        |
| 309 | + */  | 
                                                        |
| 310 | + public function has($class_name = '')  | 
                                                        |
| 311 | +	{ | 
                                                        |
| 312 | + // all legacy models have the same dependencies  | 
                                                        |
| 313 | +		if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 314 | + $class_name = 'LEGACY_MODELS';  | 
                                                        |
| 315 | + }  | 
                                                        |
| 316 | + return isset($this->_dependency_map[$class_name]) ? true : false;  | 
                                                        |
| 317 | + }  | 
                                                        |
| 318 | +  | 
                                                        |
| 319 | +  | 
                                                        |
| 320 | +  | 
                                                        |
| 321 | + /**  | 
                                                        |
| 322 | + * returns TRUE if dependency map contains a listing for the provided class name AND dependency  | 
                                                        |
| 323 | + *  | 
                                                        |
| 324 | + * @param string $class_name  | 
                                                        |
| 325 | + * @param string $dependency  | 
                                                        |
| 326 | + * @return bool  | 
                                                        |
| 327 | + */  | 
                                                        |
| 328 | + public function has_dependency_for_class($class_name = '', $dependency = '')  | 
                                                        |
| 329 | +	{ | 
                                                        |
| 330 | + // all legacy models have the same dependencies  | 
                                                        |
| 331 | +		if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 332 | + $class_name = 'LEGACY_MODELS';  | 
                                                        |
| 333 | + }  | 
                                                        |
| 334 | + $dependency = $this->get_alias($dependency);  | 
                                                        |
| 335 | + return isset($this->_dependency_map[$class_name][$dependency])  | 
                                                        |
| 336 | + ? true  | 
                                                        |
| 337 | + : false;  | 
                                                        |
| 338 | + }  | 
                                                        |
| 339 | +  | 
                                                        |
| 340 | +  | 
                                                        |
| 341 | +  | 
                                                        |
| 342 | + /**  | 
                                                        |
| 343 | + * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned  | 
                                                        |
| 344 | + *  | 
                                                        |
| 345 | + * @param string $class_name  | 
                                                        |
| 346 | + * @param string $dependency  | 
                                                        |
| 347 | + * @return int  | 
                                                        |
| 348 | + */  | 
                                                        |
| 349 | + public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')  | 
                                                        |
| 350 | +	{ | 
                                                        |
| 351 | + // all legacy models have the same dependencies  | 
                                                        |
| 352 | +		if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 353 | + $class_name = 'LEGACY_MODELS';  | 
                                                        |
| 354 | + }  | 
                                                        |
| 355 | + $dependency = $this->get_alias($dependency);  | 
                                                        |
| 356 | + return $this->has_dependency_for_class($class_name, $dependency)  | 
                                                        |
| 357 | + ? $this->_dependency_map[$class_name][$dependency]  | 
                                                        |
| 358 | + : EE_Dependency_Map::not_registered;  | 
                                                        |
| 359 | + }  | 
                                                        |
| 360 | +  | 
                                                        |
| 361 | +  | 
                                                        |
| 362 | +  | 
                                                        |
| 363 | + /**  | 
                                                        |
| 364 | + * @param string $class_name  | 
                                                        |
| 365 | + * @return string | Closure  | 
                                                        |
| 366 | + */  | 
                                                        |
| 367 | + public function class_loader($class_name)  | 
                                                        |
| 368 | +	{ | 
                                                        |
| 369 | + // all legacy models use load_model()  | 
                                                        |
| 370 | +		if(strpos($class_name, 'EEM_') === 0){ | 
                                                        |
| 371 | + return 'load_model';  | 
                                                        |
| 372 | + }  | 
                                                        |
| 373 | + $class_name = $this->get_alias($class_name);  | 
                                                        |
| 374 | + return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : '';  | 
                                                        |
| 375 | + }  | 
                                                        |
| 376 | +  | 
                                                        |
| 377 | +  | 
                                                        |
| 378 | +  | 
                                                        |
| 379 | + /**  | 
                                                        |
| 380 | + * @return array  | 
                                                        |
| 381 | + */  | 
                                                        |
| 382 | + public function class_loaders()  | 
                                                        |
| 383 | +	{ | 
                                                        |
| 384 | + return $this->_class_loaders;  | 
                                                        |
| 385 | + }  | 
                                                        |
| 386 | +  | 
                                                        |
| 387 | +  | 
                                                        |
| 388 | +  | 
                                                        |
| 389 | + /**  | 
                                                        |
| 390 | + * adds an alias for a classname  | 
                                                        |
| 391 | + *  | 
                                                        |
| 392 | + * @param string $fqcn the class name that should be used (concrete class to replace interface)  | 
                                                        |
| 393 | + * @param string $alias the class name that would be type hinted for (abstract parent or interface)  | 
                                                        |
| 394 | + * @param string $for_class the class that has the dependency (is type hinting for the interface)  | 
                                                        |
| 395 | + */  | 
                                                        |
| 396 | + public function add_alias($fqcn, $alias, $for_class = '')  | 
                                                        |
| 397 | +	{ | 
                                                        |
| 398 | + $this->class_cache->addAlias($alias, $fqcn, $for_class);  | 
                                                        |
| 399 | + }  | 
                                                        |
| 400 | +  | 
                                                        |
| 401 | +  | 
                                                        |
| 402 | +  | 
                                                        |
| 403 | + /**  | 
                                                        |
| 404 | + * PLZ NOTE: a better name for this method would be is_alias()  | 
                                                        |
| 405 | + * because it returns TRUE if the provided fully qualified name IS an alias  | 
                                                        |
| 406 | + *  | 
                                                        |
| 407 | + * @param string $fqn  | 
                                                        |
| 408 | + * @param string $for_class  | 
                                                        |
| 409 | + * @return bool  | 
                                                        |
| 410 | + */  | 
                                                        |
| 411 | + public function has_alias($fqn = '', $for_class = '')  | 
                                                        |
| 412 | +	{ | 
                                                        |
| 413 | + return $this->class_cache->isAlias($fqn, $for_class);  | 
                                                        |
| 414 | + }  | 
                                                        |
| 415 | +  | 
                                                        |
| 416 | +  | 
                                                        |
| 417 | +  | 
                                                        |
| 418 | + /**  | 
                                                        |
| 419 | + * PLZ NOTE: a better name for this method would be get_fqn_for_alias()  | 
                                                        |
| 420 | + * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias  | 
                                                        |
| 421 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN  | 
                                                        |
| 422 | + * for example:  | 
                                                        |
| 423 | + * if the following two entries were added to the _aliases array:  | 
                                                        |
| 424 | + * array(  | 
                                                        |
| 425 | + * 'interface_alias' => 'some\namespace\interface'  | 
                                                        |
| 426 | + * 'some\namespace\interface' => 'some\namespace\classname'  | 
                                                        |
| 427 | + * )  | 
                                                        |
| 428 | + * then one could use EE_Registry::instance()->create( 'interface_alias' )  | 
                                                        |
| 429 | + * to load an instance of 'some\namespace\classname'  | 
                                                        |
| 430 | + *  | 
                                                        |
| 431 | + * @param string $alias  | 
                                                        |
| 432 | + * @param string $for_class  | 
                                                        |
| 433 | + * @return string  | 
                                                        |
| 434 | + */  | 
                                                        |
| 435 | + public function get_alias($alias = '', $for_class = '')  | 
                                                        |
| 436 | +	{ | 
                                                        |
| 437 | + return (string) $this->class_cache->getFqnForAlias($alias, $for_class);  | 
                                                        |
| 438 | + }  | 
                                                        |
| 439 | +  | 
                                                        |
| 440 | +  | 
                                                        |
| 441 | +  | 
                                                        |
| 442 | + /**  | 
                                                        |
| 443 | + * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,  | 
                                                        |
| 444 | + * if one exists, or whether a new object should be generated every time the requested class is loaded.  | 
                                                        |
| 445 | + * This is done by using the following class constants:  | 
                                                        |
| 446 | + * EE_Dependency_Map::load_from_cache - loads previously instantiated object  | 
                                                        |
| 447 | + * EE_Dependency_Map::load_new_object - generates a new object every time  | 
                                                        |
| 448 | + */  | 
                                                        |
| 449 | + protected function _register_core_dependencies()  | 
                                                        |
| 450 | +	{ | 
                                                        |
| 451 | + $this->_dependency_map = array(  | 
                                                        |
| 452 | + 'EE_Request_Handler' => array(  | 
                                                        |
| 453 | + 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 454 | + ),  | 
                                                        |
| 455 | + 'EE_System' => array(  | 
                                                        |
| 456 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 457 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 458 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 459 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 460 | + ),  | 
                                                        |
| 461 | + 'EE_Session' => array(  | 
                                                        |
| 462 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 463 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 464 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 465 | + 'EE_Encryption' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 466 | + ),  | 
                                                        |
| 467 | + 'EE_Cart' => array(  | 
                                                        |
| 468 | + 'EE_Session' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 469 | + ),  | 
                                                        |
| 470 | + 'EE_Front_Controller' => array(  | 
                                                        |
| 471 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 472 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 473 | + 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 474 | + ),  | 
                                                        |
| 475 | + 'EE_Messenger_Collection_Loader' => array(  | 
                                                        |
| 476 | + 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 477 | + ),  | 
                                                        |
| 478 | + 'EE_Message_Type_Collection_Loader' => array(  | 
                                                        |
| 479 | + 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 480 | + ),  | 
                                                        |
| 481 | + 'EE_Message_Resource_Manager' => array(  | 
                                                        |
| 482 | + 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 483 | + 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 484 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 485 | + ),  | 
                                                        |
| 486 | + 'EE_Message_Factory' => array(  | 
                                                        |
| 487 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 488 | + ),  | 
                                                        |
| 489 | + 'EE_messages' => array(  | 
                                                        |
| 490 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 491 | + ),  | 
                                                        |
| 492 | + 'EE_Messages_Generator' => array(  | 
                                                        |
| 493 | + 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 494 | + 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 495 | + 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 496 | + 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 497 | + ),  | 
                                                        |
| 498 | + 'EE_Messages_Processor' => array(  | 
                                                        |
| 499 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 500 | + ),  | 
                                                        |
| 501 | + 'EE_Messages_Queue' => array(  | 
                                                        |
| 502 | + 'EE_Message_Repository' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 503 | + ),  | 
                                                        |
| 504 | + 'EE_Messages_Template_Defaults' => array(  | 
                                                        |
| 505 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 506 | + 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 507 | + ),  | 
                                                        |
| 508 | + 'EE_Message_To_Generate_From_Request' => array(  | 
                                                        |
| 509 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 510 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 511 | + ),  | 
                                                        |
| 512 | + 'EventEspresso\core\services\commands\CommandBus' => array(  | 
                                                        |
| 513 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 514 | + ),  | 
                                                        |
| 515 | + 'EventEspresso\services\commands\CommandHandler' => array(  | 
                                                        |
| 516 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 517 | + 'CommandBusInterface' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 518 | + ),  | 
                                                        |
| 519 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => array(  | 
                                                        |
| 520 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 521 | + ),  | 
                                                        |
| 522 | + 'EventEspresso\core\services\commands\CompositeCommandHandler' => array(  | 
                                                        |
| 523 | + 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 524 | + 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 525 | + ),  | 
                                                        |
| 526 | + 'EventEspresso\core\services\commands\CommandFactory' => array(  | 
                                                        |
| 527 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 528 | + ),  | 
                                                        |
| 529 | + 'EventEspresso\core\services\commands\middleware\CapChecker' => array(  | 
                                                        |
| 530 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 531 | + ),  | 
                                                        |
| 532 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => array(  | 
                                                        |
| 533 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 534 | + ),  | 
                                                        |
| 535 | + 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => array(  | 
                                                        |
| 536 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 537 | + ),  | 
                                                        |
| 538 | + 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => array(  | 
                                                        |
| 539 | + 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 540 | + ),  | 
                                                        |
| 541 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => array(  | 
                                                        |
| 542 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 543 | + ),  | 
                                                        |
| 544 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => array(  | 
                                                        |
| 545 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 546 | + ),  | 
                                                        |
| 547 | + 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => array(  | 
                                                        |
| 548 | + 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 549 | + ),  | 
                                                        |
| 550 | + 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array(  | 
                                                        |
| 551 | + 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 552 | + ),  | 
                                                        |
| 553 | + 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => array(  | 
                                                        |
| 554 | + 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 555 | + ),  | 
                                                        |
| 556 | + 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => array(  | 
                                                        |
| 557 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 558 | + ),  | 
                                                        |
| 559 | + 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => array(  | 
                                                        |
| 560 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 561 | + ),  | 
                                                        |
| 562 | + 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => array(  | 
                                                        |
| 563 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 564 | + ),  | 
                                                        |
| 565 | + 'EventEspresso\core\services\database\TableManager' => array(  | 
                                                        |
| 566 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 567 | + ),  | 
                                                        |
| 568 | + 'EE_Data_Migration_Class_Base' => array(  | 
                                                        |
| 569 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 570 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 571 | + ),  | 
                                                        |
| 572 | + 'EE_DMS_Core_4_1_0' => array(  | 
                                                        |
| 573 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 574 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 575 | + ),  | 
                                                        |
| 576 | + 'EE_DMS_Core_4_2_0' => array(  | 
                                                        |
| 577 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 578 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 579 | + ),  | 
                                                        |
| 580 | + 'EE_DMS_Core_4_3_0' => array(  | 
                                                        |
| 581 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 582 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 583 | + ),  | 
                                                        |
| 584 | + 'EE_DMS_Core_4_4_0' => array(  | 
                                                        |
| 585 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 586 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 587 | + ),  | 
                                                        |
| 588 | + 'EE_DMS_Core_4_5_0' => array(  | 
                                                        |
| 589 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 590 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 591 | + ),  | 
                                                        |
| 592 | + 'EE_DMS_Core_4_6_0' => array(  | 
                                                        |
| 593 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 594 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 595 | + ),  | 
                                                        |
| 596 | + 'EE_DMS_Core_4_7_0' => array(  | 
                                                        |
| 597 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 598 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 599 | + ),  | 
                                                        |
| 600 | + 'EE_DMS_Core_4_8_0' => array(  | 
                                                        |
| 601 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 602 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 603 | + ),  | 
                                                        |
| 604 | + 'EE_DMS_Core_4_9_0' => array(  | 
                                                        |
| 605 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 606 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 607 | + ),  | 
                                                        |
| 608 | + 'EventEspresso\core\services\assets\I18nRegistry' => array(  | 
                                                        |
| 609 | + array(),  | 
                                                        |
| 610 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 611 | + ),  | 
                                                        |
| 612 | + 'EventEspresso\core\services\assets\Registry' => array(  | 
                                                        |
| 613 | + 'EE_Template_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 614 | + 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 615 | + 'EventEspresso\core\services\assets\I18nRegistry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 616 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 617 | + ),  | 
                                                        |
| 618 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => array(  | 
                                                        |
| 619 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 620 | + ),  | 
                                                        |
| 621 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => array(  | 
                                                        |
| 622 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 623 | + ),  | 
                                                        |
| 624 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => array(  | 
                                                        |
| 625 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 626 | + ),  | 
                                                        |
| 627 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => array(  | 
                                                        |
| 628 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 629 | + ),  | 
                                                        |
| 630 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => array(  | 
                                                        |
| 631 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 632 | + ),  | 
                                                        |
| 633 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => array(  | 
                                                        |
| 634 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 635 | + ),  | 
                                                        |
| 636 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => array(  | 
                                                        |
| 637 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 638 | + ),  | 
                                                        |
| 639 | + 'EventEspresso\core\services\cache\BasicCacheManager' => array(  | 
                                                        |
| 640 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 641 | + ),  | 
                                                        |
| 642 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => array(  | 
                                                        |
| 643 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 644 | + ),  | 
                                                        |
| 645 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => array(  | 
                                                        |
| 646 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 647 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 648 | + ),  | 
                                                        |
| 649 | + 'EventEspresso\core\domain\values\EmailAddress' => array(  | 
                                                        |
| 650 | + null,  | 
                                                        |
| 651 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 652 | + ),  | 
                                                        |
| 653 | + 'EventEspresso\core\services\orm\ModelFieldFactory' => array(  | 
                                                        |
| 654 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 655 | + ),  | 
                                                        |
| 656 | + 'LEGACY_MODELS' => array(  | 
                                                        |
| 657 | + null,  | 
                                                        |
| 658 | + 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 659 | + ),  | 
                                                        |
| 660 | + 'EE_Module_Request_Router' => array(  | 
                                                        |
| 661 | + 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 662 | + ),  | 
                                                        |
| 663 | + 'EE_Registration_Processor' => array(  | 
                                                        |
| 664 | + 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 665 | + ),  | 
                                                        |
| 666 | + 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => array(  | 
                                                        |
| 667 | + null,  | 
                                                        |
| 668 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 669 | + 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 670 | + ),  | 
                                                        |
| 671 | + 'EventEspresso\core\services\licensing\LicenseService' => array(  | 
                                                        |
| 672 | + 'EventEspresso\core\domain\services\pue\Stats' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 673 | + 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 674 | + ),  | 
                                                        |
| 675 | 675 | 'EE_Admin_Transactions_List_Table' => array(  | 
                                                        
| 676 | - null,  | 
                                                        |
| 677 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 678 | - ),  | 
                                                        |
| 679 | - 'EventEspresso\core\domain\services\pue\Stats' => array(  | 
                                                        |
| 680 | - 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 681 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 682 | - 'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 683 | - ),  | 
                                                        |
| 684 | - 'EventEspresso\core\domain\services\pue\Config' => array(  | 
                                                        |
| 685 | - 'EE_Network_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 686 | - 'EE_Config' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 687 | - ),  | 
                                                        |
| 688 | - 'EventEspresso\core\domain\services\pue\StatsGatherer' => array(  | 
                                                        |
| 689 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 690 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 691 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 692 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 693 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 694 | - 'EEM_Transaction' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 695 | - 'EE_Config' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 696 | - ),  | 
                                                        |
| 697 | - 'EventEspresso\core\domain\services\admin\ExitModal' => array(  | 
                                                        |
| 698 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 699 | - ),  | 
                                                        |
| 700 | - 'EventEspresso\core\domain\services\admin\PluginUpsells' => array(  | 
                                                        |
| 701 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 702 | - ),  | 
                                                        |
| 703 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => array(  | 
                                                        |
| 704 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 705 | - 'EE_Session' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 706 | - ),  | 
                                                        |
| 707 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings' => array(  | 
                                                        |
| 708 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 709 | - ),  | 
                                                        |
| 710 | - 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => array(  | 
                                                        |
| 711 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 712 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 713 | - 'EE_Session' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 714 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 715 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 716 | - ),  | 
                                                        |
| 717 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => array(  | 
                                                        |
| 718 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 719 | - ),  | 
                                                        |
| 720 | - 'EventEspresso\core\services\loaders\ObjectIdentifier' => array(  | 
                                                        |
| 721 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 722 | - ),  | 
                                                        |
| 723 | - );  | 
                                                        |
| 724 | - }  | 
                                                        |
| 725 | -  | 
                                                        |
| 726 | -  | 
                                                        |
| 727 | - /**  | 
                                                        |
| 728 | - * Registers how core classes are loaded.  | 
                                                        |
| 729 | - * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:  | 
                                                        |
| 730 | - * 'EE_Request_Handler' => 'load_core'  | 
                                                        |
| 731 | - * 'EE_Messages_Queue' => 'load_lib'  | 
                                                        |
| 732 | - * 'EEH_Debug_Tools' => 'load_helper'  | 
                                                        |
| 733 | - * or, if greater control is required, by providing a custom closure. For example:  | 
                                                        |
| 734 | -     *        'Some_Class' => function () { | 
                                                        |
| 735 | - * return new Some_Class();  | 
                                                        |
| 736 | - * },  | 
                                                        |
| 737 | - * This is required for instantiating dependencies  | 
                                                        |
| 738 | - * where an interface has been type hinted in a class constructor. For example:  | 
                                                        |
| 739 | -     *        'Required_Interface' => function () { | 
                                                        |
| 740 | - * return new A_Class_That_Implements_Required_Interface();  | 
                                                        |
| 741 | - * },  | 
                                                        |
| 742 | - *  | 
                                                        |
| 743 | - */  | 
                                                        |
| 744 | - protected function _register_core_class_loaders()  | 
                                                        |
| 745 | -    { | 
                                                        |
| 746 | - //for PHP5.3 compat, we need to register any properties called here in a variable because `$this` cannot  | 
                                                        |
| 747 | - //be used in a closure.  | 
                                                        |
| 748 | - $request = &$this->request;  | 
                                                        |
| 749 | - $response = &$this->response;  | 
                                                        |
| 750 | - $legacy_request = &$this->legacy_request;  | 
                                                        |
| 751 | - // $loader = &$this->loader;  | 
                                                        |
| 752 | - $this->_class_loaders = array(  | 
                                                        |
| 753 | - //load_core  | 
                                                        |
| 754 | - 'EE_Capabilities' => 'load_core',  | 
                                                        |
| 755 | - 'EE_Encryption' => 'load_core',  | 
                                                        |
| 756 | - 'EE_Front_Controller' => 'load_core',  | 
                                                        |
| 757 | - 'EE_Module_Request_Router' => 'load_core',  | 
                                                        |
| 758 | - 'EE_Registry' => 'load_core',  | 
                                                        |
| 759 | -            'EE_Request'               => function () use (&$legacy_request) { | 
                                                        |
| 760 | - return $legacy_request;  | 
                                                        |
| 761 | - },  | 
                                                        |
| 762 | -            'EventEspresso\core\services\request\Request' => function () use (&$request) { | 
                                                        |
| 763 | - return $request;  | 
                                                        |
| 764 | - },  | 
                                                        |
| 765 | -            'EventEspresso\core\services\request\Response' => function () use (&$response) { | 
                                                        |
| 766 | - return $response;  | 
                                                        |
| 767 | - },  | 
                                                        |
| 768 | - 'EE_Request_Handler' => 'load_core',  | 
                                                        |
| 769 | - 'EE_Session' => 'load_core',  | 
                                                        |
| 770 | - 'EE_Cron_Tasks' => 'load_core',  | 
                                                        |
| 771 | - 'EE_System' => 'load_core',  | 
                                                        |
| 772 | - 'EE_Maintenance_Mode' => 'load_core',  | 
                                                        |
| 773 | - 'EE_Register_CPTs' => 'load_core',  | 
                                                        |
| 774 | - 'EE_Admin' => 'load_core',  | 
                                                        |
| 775 | - //load_lib  | 
                                                        |
| 776 | - 'EE_Message_Resource_Manager' => 'load_lib',  | 
                                                        |
| 777 | - 'EE_Message_Type_Collection' => 'load_lib',  | 
                                                        |
| 778 | - 'EE_Message_Type_Collection_Loader' => 'load_lib',  | 
                                                        |
| 779 | - 'EE_Messenger_Collection' => 'load_lib',  | 
                                                        |
| 780 | - 'EE_Messenger_Collection_Loader' => 'load_lib',  | 
                                                        |
| 781 | - 'EE_Messages_Processor' => 'load_lib',  | 
                                                        |
| 782 | - 'EE_Message_Repository' => 'load_lib',  | 
                                                        |
| 783 | - 'EE_Messages_Queue' => 'load_lib',  | 
                                                        |
| 784 | - 'EE_Messages_Data_Handler_Collection' => 'load_lib',  | 
                                                        |
| 785 | - 'EE_Message_Template_Group_Collection' => 'load_lib',  | 
                                                        |
| 786 | - 'EE_Payment_Method_Manager' => 'load_lib',  | 
                                                        |
| 787 | -            'EE_Messages_Generator'                => function () { | 
                                                        |
| 788 | - return EE_Registry::instance()->load_lib(  | 
                                                        |
| 789 | - 'Messages_Generator',  | 
                                                        |
| 790 | - array(),  | 
                                                        |
| 791 | - false,  | 
                                                        |
| 792 | - false  | 
                                                        |
| 793 | - );  | 
                                                        |
| 794 | - },  | 
                                                        |
| 795 | -            'EE_Messages_Template_Defaults'        => function ($arguments = array()) { | 
                                                        |
| 796 | - return EE_Registry::instance()->load_lib(  | 
                                                        |
| 797 | - 'Messages_Template_Defaults',  | 
                                                        |
| 798 | - $arguments,  | 
                                                        |
| 799 | - false,  | 
                                                        |
| 800 | - false  | 
                                                        |
| 801 | - );  | 
                                                        |
| 802 | - },  | 
                                                        |
| 803 | - //load_helper  | 
                                                        |
| 804 | -            'EEH_Parse_Shortcodes'                 => function () { | 
                                                        |
| 805 | -                if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { | 
                                                        |
| 806 | - return new EEH_Parse_Shortcodes();  | 
                                                        |
| 807 | - }  | 
                                                        |
| 808 | - return null;  | 
                                                        |
| 809 | - },  | 
                                                        |
| 810 | -            'EE_Template_Config'                   => function () { | 
                                                        |
| 811 | - return EE_Config::instance()->template_settings;  | 
                                                        |
| 812 | - },  | 
                                                        |
| 813 | -            'EE_Currency_Config'                   => function () { | 
                                                        |
| 814 | - return EE_Config::instance()->currency;  | 
                                                        |
| 815 | - },  | 
                                                        |
| 816 | -            'EE_Registration_Config'                   => function () { | 
                                                        |
| 817 | - return EE_Config::instance()->registration;  | 
                                                        |
| 818 | - },  | 
                                                        |
| 819 | -            'EE_Core_Config'                   => function () { | 
                                                        |
| 820 | - return EE_Config::instance()->core;  | 
                                                        |
| 821 | - },  | 
                                                        |
| 822 | -            'EventEspresso\core\services\loaders\Loader' => function () { | 
                                                        |
| 823 | - return LoaderFactory::getLoader();  | 
                                                        |
| 824 | - },  | 
                                                        |
| 825 | -            'EE_Network_Config' => function() { | 
                                                        |
| 826 | - return EE_Network_Config::instance();  | 
                                                        |
| 827 | - },  | 
                                                        |
| 828 | -            'EE_Config' => function () { | 
                                                        |
| 829 | - return EE_Config::instance();  | 
                                                        |
| 830 | - },  | 
                                                        |
| 831 | - 'EE_Base' => 'load_core',  | 
                                                        |
| 832 | - );  | 
                                                        |
| 833 | - }  | 
                                                        |
| 834 | -  | 
                                                        |
| 835 | -  | 
                                                        |
| 836 | -  | 
                                                        |
| 837 | -  | 
                                                        |
| 838 | - /**  | 
                                                        |
| 839 | - * can be used for supplying alternate names for classes,  | 
                                                        |
| 840 | - * or for connecting interface names to instantiable classes  | 
                                                        |
| 841 | - */  | 
                                                        |
| 842 | - protected function _register_core_aliases()  | 
                                                        |
| 843 | -    { | 
                                                        |
| 844 | - $aliases = array(  | 
                                                        |
| 845 | - 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface',  | 
                                                        |
| 846 | - 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus',  | 
                                                        |
| 847 | - 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',  | 
                                                        |
| 848 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager',  | 
                                                        |
| 849 | - 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker',  | 
                                                        |
| 850 | - 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook',  | 
                                                        |
| 851 | - 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',  | 
                                                        |
| 852 | - 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',  | 
                                                        |
| 853 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',  | 
                                                        |
| 854 | - 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',  | 
                                                        |
| 855 | - 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',  | 
                                                        |
| 856 | - 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',  | 
                                                        |
| 857 | - 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',  | 
                                                        |
| 858 | - 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',  | 
                                                        |
| 859 | - 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',  | 
                                                        |
| 860 | - 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',  | 
                                                        |
| 861 | - 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',  | 
                                                        |
| 862 | - 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',  | 
                                                        |
| 863 | - 'TableManager' => 'EventEspresso\core\services\database\TableManager',  | 
                                                        |
| 864 | - 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis',  | 
                                                        |
| 865 | - 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode',  | 
                                                        |
| 866 | - 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',  | 
                                                        |
| 867 | - 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode',  | 
                                                        |
| 868 | - 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage',  | 
                                                        |
| 869 | - 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface',  | 
                                                        |
| 870 | - 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader',  | 
                                                        |
| 871 | - 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface',  | 
                                                        |
| 872 | - 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory',  | 
                                                        |
| 873 | - 'EventEspresso\core\domain\services\session\SessionIdentifierInterface' => 'EE_Session',  | 
                                                        |
| 874 | - 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',  | 
                                                        |
| 875 | - 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',  | 
                                                        |
| 876 | - 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface',  | 
                                                        |
| 877 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',  | 
                                                        |
| 878 | - 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface',  | 
                                                        |
| 879 | - 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer',  | 
                                                        |
| 880 | - 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request',  | 
                                                        |
| 881 | - 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response',  | 
                                                        |
| 882 | - 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain',  | 
                                                        |
| 883 | - );  | 
                                                        |
| 884 | -        foreach ($aliases as $alias => $fqn) { | 
                                                        |
| 885 | - $this->class_cache->addAlias($fqn, $alias);  | 
                                                        |
| 886 | - }  | 
                                                        |
| 887 | -        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { | 
                                                        |
| 888 | - $this->class_cache->addAlias(  | 
                                                        |
| 889 | - 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',  | 
                                                        |
| 890 | - 'EventEspresso\core\services\notices\NoticeConverterInterface'  | 
                                                        |
| 891 | - );  | 
                                                        |
| 892 | - }  | 
                                                        |
| 893 | - }  | 
                                                        |
| 894 | -  | 
                                                        |
| 895 | -  | 
                                                        |
| 896 | -  | 
                                                        |
| 897 | - /**  | 
                                                        |
| 898 | - * This is used to reset the internal map and class_loaders to their original default state at the beginning of the  | 
                                                        |
| 899 | - * request Primarily used by unit tests.  | 
                                                        |
| 900 | - */  | 
                                                        |
| 901 | - public function reset()  | 
                                                        |
| 902 | -    { | 
                                                        |
| 903 | - $this->_register_core_class_loaders();  | 
                                                        |
| 904 | - $this->_register_core_dependencies();  | 
                                                        |
| 905 | - }  | 
                                                        |
| 676 | + null,  | 
                                                        |
| 677 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 678 | + ),  | 
                                                        |
| 679 | + 'EventEspresso\core\domain\services\pue\Stats' => array(  | 
                                                        |
| 680 | + 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 681 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 682 | + 'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 683 | + ),  | 
                                                        |
| 684 | + 'EventEspresso\core\domain\services\pue\Config' => array(  | 
                                                        |
| 685 | + 'EE_Network_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 686 | + 'EE_Config' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 687 | + ),  | 
                                                        |
| 688 | + 'EventEspresso\core\domain\services\pue\StatsGatherer' => array(  | 
                                                        |
| 689 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 690 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 691 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 692 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 693 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 694 | + 'EEM_Transaction' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 695 | + 'EE_Config' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 696 | + ),  | 
                                                        |
| 697 | + 'EventEspresso\core\domain\services\admin\ExitModal' => array(  | 
                                                        |
| 698 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 699 | + ),  | 
                                                        |
| 700 | + 'EventEspresso\core\domain\services\admin\PluginUpsells' => array(  | 
                                                        |
| 701 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 702 | + ),  | 
                                                        |
| 703 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => array(  | 
                                                        |
| 704 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 705 | + 'EE_Session' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 706 | + ),  | 
                                                        |
| 707 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings' => array(  | 
                                                        |
| 708 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 709 | + ),  | 
                                                        |
| 710 | + 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => array(  | 
                                                        |
| 711 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 712 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 713 | + 'EE_Session' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 714 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 715 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 716 | + ),  | 
                                                        |
| 717 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => array(  | 
                                                        |
| 718 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 719 | + ),  | 
                                                        |
| 720 | + 'EventEspresso\core\services\loaders\ObjectIdentifier' => array(  | 
                                                        |
| 721 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 722 | + ),  | 
                                                        |
| 723 | + );  | 
                                                        |
| 724 | + }  | 
                                                        |
| 725 | +  | 
                                                        |
| 726 | +  | 
                                                        |
| 727 | + /**  | 
                                                        |
| 728 | + * Registers how core classes are loaded.  | 
                                                        |
| 729 | + * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:  | 
                                                        |
| 730 | + * 'EE_Request_Handler' => 'load_core'  | 
                                                        |
| 731 | + * 'EE_Messages_Queue' => 'load_lib'  | 
                                                        |
| 732 | + * 'EEH_Debug_Tools' => 'load_helper'  | 
                                                        |
| 733 | + * or, if greater control is required, by providing a custom closure. For example:  | 
                                                        |
| 734 | +	 *        'Some_Class' => function () { | 
                                                        |
| 735 | + * return new Some_Class();  | 
                                                        |
| 736 | + * },  | 
                                                        |
| 737 | + * This is required for instantiating dependencies  | 
                                                        |
| 738 | + * where an interface has been type hinted in a class constructor. For example:  | 
                                                        |
| 739 | +	 *        'Required_Interface' => function () { | 
                                                        |
| 740 | + * return new A_Class_That_Implements_Required_Interface();  | 
                                                        |
| 741 | + * },  | 
                                                        |
| 742 | + *  | 
                                                        |
| 743 | + */  | 
                                                        |
| 744 | + protected function _register_core_class_loaders()  | 
                                                        |
| 745 | +	{ | 
                                                        |
| 746 | + //for PHP5.3 compat, we need to register any properties called here in a variable because `$this` cannot  | 
                                                        |
| 747 | + //be used in a closure.  | 
                                                        |
| 748 | + $request = &$this->request;  | 
                                                        |
| 749 | + $response = &$this->response;  | 
                                                        |
| 750 | + $legacy_request = &$this->legacy_request;  | 
                                                        |
| 751 | + // $loader = &$this->loader;  | 
                                                        |
| 752 | + $this->_class_loaders = array(  | 
                                                        |
| 753 | + //load_core  | 
                                                        |
| 754 | + 'EE_Capabilities' => 'load_core',  | 
                                                        |
| 755 | + 'EE_Encryption' => 'load_core',  | 
                                                        |
| 756 | + 'EE_Front_Controller' => 'load_core',  | 
                                                        |
| 757 | + 'EE_Module_Request_Router' => 'load_core',  | 
                                                        |
| 758 | + 'EE_Registry' => 'load_core',  | 
                                                        |
| 759 | +			'EE_Request'               => function () use (&$legacy_request) { | 
                                                        |
| 760 | + return $legacy_request;  | 
                                                        |
| 761 | + },  | 
                                                        |
| 762 | +			'EventEspresso\core\services\request\Request' => function () use (&$request) { | 
                                                        |
| 763 | + return $request;  | 
                                                        |
| 764 | + },  | 
                                                        |
| 765 | +			'EventEspresso\core\services\request\Response' => function () use (&$response) { | 
                                                        |
| 766 | + return $response;  | 
                                                        |
| 767 | + },  | 
                                                        |
| 768 | + 'EE_Request_Handler' => 'load_core',  | 
                                                        |
| 769 | + 'EE_Session' => 'load_core',  | 
                                                        |
| 770 | + 'EE_Cron_Tasks' => 'load_core',  | 
                                                        |
| 771 | + 'EE_System' => 'load_core',  | 
                                                        |
| 772 | + 'EE_Maintenance_Mode' => 'load_core',  | 
                                                        |
| 773 | + 'EE_Register_CPTs' => 'load_core',  | 
                                                        |
| 774 | + 'EE_Admin' => 'load_core',  | 
                                                        |
| 775 | + //load_lib  | 
                                                        |
| 776 | + 'EE_Message_Resource_Manager' => 'load_lib',  | 
                                                        |
| 777 | + 'EE_Message_Type_Collection' => 'load_lib',  | 
                                                        |
| 778 | + 'EE_Message_Type_Collection_Loader' => 'load_lib',  | 
                                                        |
| 779 | + 'EE_Messenger_Collection' => 'load_lib',  | 
                                                        |
| 780 | + 'EE_Messenger_Collection_Loader' => 'load_lib',  | 
                                                        |
| 781 | + 'EE_Messages_Processor' => 'load_lib',  | 
                                                        |
| 782 | + 'EE_Message_Repository' => 'load_lib',  | 
                                                        |
| 783 | + 'EE_Messages_Queue' => 'load_lib',  | 
                                                        |
| 784 | + 'EE_Messages_Data_Handler_Collection' => 'load_lib',  | 
                                                        |
| 785 | + 'EE_Message_Template_Group_Collection' => 'load_lib',  | 
                                                        |
| 786 | + 'EE_Payment_Method_Manager' => 'load_lib',  | 
                                                        |
| 787 | +			'EE_Messages_Generator'                => function () { | 
                                                        |
| 788 | + return EE_Registry::instance()->load_lib(  | 
                                                        |
| 789 | + 'Messages_Generator',  | 
                                                        |
| 790 | + array(),  | 
                                                        |
| 791 | + false,  | 
                                                        |
| 792 | + false  | 
                                                        |
| 793 | + );  | 
                                                        |
| 794 | + },  | 
                                                        |
| 795 | +			'EE_Messages_Template_Defaults'        => function ($arguments = array()) { | 
                                                        |
| 796 | + return EE_Registry::instance()->load_lib(  | 
                                                        |
| 797 | + 'Messages_Template_Defaults',  | 
                                                        |
| 798 | + $arguments,  | 
                                                        |
| 799 | + false,  | 
                                                        |
| 800 | + false  | 
                                                        |
| 801 | + );  | 
                                                        |
| 802 | + },  | 
                                                        |
| 803 | + //load_helper  | 
                                                        |
| 804 | +			'EEH_Parse_Shortcodes'                 => function () { | 
                                                        |
| 805 | +				if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { | 
                                                        |
| 806 | + return new EEH_Parse_Shortcodes();  | 
                                                        |
| 807 | + }  | 
                                                        |
| 808 | + return null;  | 
                                                        |
| 809 | + },  | 
                                                        |
| 810 | +			'EE_Template_Config'                   => function () { | 
                                                        |
| 811 | + return EE_Config::instance()->template_settings;  | 
                                                        |
| 812 | + },  | 
                                                        |
| 813 | +			'EE_Currency_Config'                   => function () { | 
                                                        |
| 814 | + return EE_Config::instance()->currency;  | 
                                                        |
| 815 | + },  | 
                                                        |
| 816 | +			'EE_Registration_Config'                   => function () { | 
                                                        |
| 817 | + return EE_Config::instance()->registration;  | 
                                                        |
| 818 | + },  | 
                                                        |
| 819 | +			'EE_Core_Config'                   => function () { | 
                                                        |
| 820 | + return EE_Config::instance()->core;  | 
                                                        |
| 821 | + },  | 
                                                        |
| 822 | +			'EventEspresso\core\services\loaders\Loader' => function () { | 
                                                        |
| 823 | + return LoaderFactory::getLoader();  | 
                                                        |
| 824 | + },  | 
                                                        |
| 825 | +			'EE_Network_Config' => function() { | 
                                                        |
| 826 | + return EE_Network_Config::instance();  | 
                                                        |
| 827 | + },  | 
                                                        |
| 828 | +			'EE_Config' => function () { | 
                                                        |
| 829 | + return EE_Config::instance();  | 
                                                        |
| 830 | + },  | 
                                                        |
| 831 | + 'EE_Base' => 'load_core',  | 
                                                        |
| 832 | + );  | 
                                                        |
| 833 | + }  | 
                                                        |
| 834 | +  | 
                                                        |
| 835 | +  | 
                                                        |
| 836 | +  | 
                                                        |
| 837 | +  | 
                                                        |
| 838 | + /**  | 
                                                        |
| 839 | + * can be used for supplying alternate names for classes,  | 
                                                        |
| 840 | + * or for connecting interface names to instantiable classes  | 
                                                        |
| 841 | + */  | 
                                                        |
| 842 | + protected function _register_core_aliases()  | 
                                                        |
| 843 | +	{ | 
                                                        |
| 844 | + $aliases = array(  | 
                                                        |
| 845 | + 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface',  | 
                                                        |
| 846 | + 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus',  | 
                                                        |
| 847 | + 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',  | 
                                                        |
| 848 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager',  | 
                                                        |
| 849 | + 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker',  | 
                                                        |
| 850 | + 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook',  | 
                                                        |
| 851 | + 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',  | 
                                                        |
| 852 | + 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',  | 
                                                        |
| 853 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',  | 
                                                        |
| 854 | + 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',  | 
                                                        |
| 855 | + 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',  | 
                                                        |
| 856 | + 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',  | 
                                                        |
| 857 | + 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',  | 
                                                        |
| 858 | + 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',  | 
                                                        |
| 859 | + 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',  | 
                                                        |
| 860 | + 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',  | 
                                                        |
| 861 | + 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',  | 
                                                        |
| 862 | + 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',  | 
                                                        |
| 863 | + 'TableManager' => 'EventEspresso\core\services\database\TableManager',  | 
                                                        |
| 864 | + 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis',  | 
                                                        |
| 865 | + 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode',  | 
                                                        |
| 866 | + 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',  | 
                                                        |
| 867 | + 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode',  | 
                                                        |
| 868 | + 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage',  | 
                                                        |
| 869 | + 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface',  | 
                                                        |
| 870 | + 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader',  | 
                                                        |
| 871 | + 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface',  | 
                                                        |
| 872 | + 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory',  | 
                                                        |
| 873 | + 'EventEspresso\core\domain\services\session\SessionIdentifierInterface' => 'EE_Session',  | 
                                                        |
| 874 | + 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',  | 
                                                        |
| 875 | + 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',  | 
                                                        |
| 876 | + 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface',  | 
                                                        |
| 877 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',  | 
                                                        |
| 878 | + 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface',  | 
                                                        |
| 879 | + 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer',  | 
                                                        |
| 880 | + 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request',  | 
                                                        |
| 881 | + 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response',  | 
                                                        |
| 882 | + 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain',  | 
                                                        |
| 883 | + );  | 
                                                        |
| 884 | +		foreach ($aliases as $alias => $fqn) { | 
                                                        |
| 885 | + $this->class_cache->addAlias($fqn, $alias);  | 
                                                        |
| 886 | + }  | 
                                                        |
| 887 | +		if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { | 
                                                        |
| 888 | + $this->class_cache->addAlias(  | 
                                                        |
| 889 | + 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',  | 
                                                        |
| 890 | + 'EventEspresso\core\services\notices\NoticeConverterInterface'  | 
                                                        |
| 891 | + );  | 
                                                        |
| 892 | + }  | 
                                                        |
| 893 | + }  | 
                                                        |
| 894 | +  | 
                                                        |
| 895 | +  | 
                                                        |
| 896 | +  | 
                                                        |
| 897 | + /**  | 
                                                        |
| 898 | + * This is used to reset the internal map and class_loaders to their original default state at the beginning of the  | 
                                                        |
| 899 | + * request Primarily used by unit tests.  | 
                                                        |
| 900 | + */  | 
                                                        |
| 901 | + public function reset()  | 
                                                        |
| 902 | +	{ | 
                                                        |
| 903 | + $this->_register_core_class_loaders();  | 
                                                        |
| 904 | + $this->_register_core_dependencies();  | 
                                                        |
| 905 | + }  | 
                                                        |
| 906 | 906 | |
| 907 | 907 | |
| 908 | 908 | }  |