@@ -24,121 +24,121 @@  | 
                                                    ||
| 24 | 24 | class InitializeCore implements InitializeInterface  | 
                                                        
| 25 | 25 |  { | 
                                                        
| 26 | 26 | |
| 27 | - /**  | 
                                                        |
| 28 | - * @var EE_Capabilities $capabilities  | 
                                                        |
| 29 | - */  | 
                                                        |
| 30 | - private $capabilities;  | 
                                                        |
| 31 | -  | 
                                                        |
| 32 | - /**  | 
                                                        |
| 33 | - * @var EE_Data_Migration_Manager $data_migration_manager  | 
                                                        |
| 34 | - */  | 
                                                        |
| 35 | - private $data_migration_manager;  | 
                                                        |
| 36 | -  | 
                                                        |
| 37 | - /**  | 
                                                        |
| 38 | - * @var EE_Maintenance_Mode $maintenance_mode  | 
                                                        |
| 39 | - */  | 
                                                        |
| 40 | - private $maintenance_mode;  | 
                                                        |
| 41 | -  | 
                                                        |
| 42 | - /**  | 
                                                        |
| 43 | - * @var RequestInterface $request  | 
                                                        |
| 44 | - */  | 
                                                        |
| 45 | - private $request;  | 
                                                        |
| 46 | -  | 
                                                        |
| 47 | - /**  | 
                                                        |
| 48 | - * @var ActivationType $activation_type  | 
                                                        |
| 49 | - */  | 
                                                        |
| 50 | - private $activation_type;  | 
                                                        |
| 51 | -  | 
                                                        |
| 52 | -  | 
                                                        |
| 53 | - /**  | 
                                                        |
| 54 | - * InitializeDatabase constructor.  | 
                                                        |
| 55 | - *  | 
                                                        |
| 56 | - * @param ActivationType $activation_type  | 
                                                        |
| 57 | - * @param EE_Capabilities $capabilities  | 
                                                        |
| 58 | - * @param EE_Data_Migration_Manager $data_migration_manager  | 
                                                        |
| 59 | - * @param EE_Maintenance_Mode $maintenance_mode  | 
                                                        |
| 60 | - * @param RequestInterface $request  | 
                                                        |
| 61 | - */  | 
                                                        |
| 62 | - public function __construct(  | 
                                                        |
| 63 | - ActivationType $activation_type,  | 
                                                        |
| 64 | - EE_Capabilities $capabilities,  | 
                                                        |
| 65 | - EE_Data_Migration_Manager $data_migration_manager,  | 
                                                        |
| 66 | - EE_Maintenance_Mode $maintenance_mode,  | 
                                                        |
| 67 | - RequestInterface $request  | 
                                                        |
| 68 | -    ) { | 
                                                        |
| 69 | - $this->activation_type = $activation_type;  | 
                                                        |
| 70 | - $this->capabilities = $capabilities;  | 
                                                        |
| 71 | - $this->data_migration_manager = $data_migration_manager;  | 
                                                        |
| 72 | - $this->maintenance_mode = $maintenance_mode;  | 
                                                        |
| 73 | - $this->request = $request;  | 
                                                        |
| 74 | - }  | 
                                                        |
| 75 | -  | 
                                                        |
| 76 | -  | 
                                                        |
| 77 | -  | 
                                                        |
| 78 | -  | 
                                                        |
| 79 | - /**  | 
                                                        |
| 80 | - * @param bool $verify_schema  | 
                                                        |
| 81 | - * @return void  | 
                                                        |
| 82 | - * @throws \EE_Error  | 
                                                        |
| 83 | - */  | 
                                                        |
| 84 | - public function initialize($verify_schema = true)  | 
                                                        |
| 85 | -    { | 
                                                        |
| 86 | - $activation_type = $this->activation_type->getActivationType();  | 
                                                        |
| 87 | - //only initialize system if we're not in maintenance mode.  | 
                                                        |
| 88 | -        if ($this->maintenance_mode->level() !== EE_Maintenance_Mode::level_2_complete_maintenance) { | 
                                                        |
| 89 | -            update_option('ee_flush_rewrite_rules', true); | 
                                                        |
| 90 | -            if ($verify_schema) { | 
                                                        |
| 91 | - // first check if we had previously attempted to setup EE's directories but failed  | 
                                                        |
| 92 | -                if (EEH_Activation::upload_directories_incomplete()) { | 
                                                        |
| 93 | - EEH_Activation::create_upload_directories();  | 
                                                        |
| 94 | - }  | 
                                                        |
| 95 | - EEH_Activation::initialize_db_and_folders();  | 
                                                        |
| 96 | - }  | 
                                                        |
| 97 | - EEH_Activation::initialize_db_content();  | 
                                                        |
| 98 | - EEH_Activation::system_initialization();  | 
                                                        |
| 99 | -        } else { | 
                                                        |
| 100 | -            $this->data_migration_manager->enqueue_db_initialization_for('Core'); | 
                                                        |
| 101 | - }  | 
                                                        |
| 102 | - if ($activation_type === ActivationType::NEW_ACTIVATION  | 
                                                        |
| 103 | - || $activation_type === ActivationType::REACTIVATION  | 
                                                        |
| 104 | - || (  | 
                                                        |
| 105 | - $activation_type === ActivationType::UPGRADE  | 
                                                        |
| 106 | - && $this->activation_type->isMajorVersionChange()  | 
                                                        |
| 107 | - )  | 
                                                        |
| 108 | -        ) { | 
                                                        |
| 109 | -            add_action('init', array($this, 'redirectToAboutPage'), 1); | 
                                                        |
| 110 | - }  | 
                                                        |
| 111 | - }  | 
                                                        |
| 112 | -  | 
                                                        |
| 113 | -  | 
                                                        |
| 114 | -  | 
                                                        |
| 115 | -  | 
                                                        |
| 116 | - /**  | 
                                                        |
| 117 | - * This redirects to the about EE page after activation  | 
                                                        |
| 118 | - *  | 
                                                        |
| 119 | - * @return void  | 
                                                        |
| 120 | - */  | 
                                                        |
| 121 | - public function redirectToAboutPage()  | 
                                                        |
| 122 | -    { | 
                                                        |
| 123 | - //if current user is an admin and it's not an ajax or rest request  | 
                                                        |
| 124 | - if (  | 
                                                        |
| 125 | - $this->request->isAdmin()  | 
                                                        |
| 126 | - && EE_Error::has_notices() !== 1  | 
                                                        |
| 127 | - && apply_filters(  | 
                                                        |
| 128 | - 'FHEE__EE_System__redirect_to_about_ee__do_redirect',  | 
                                                        |
| 129 | -                $this->capabilities->current_user_can('manage_options', 'espresso_about_default') | 
                                                        |
| 130 | - )  | 
                                                        |
| 131 | -        ) { | 
                                                        |
| 132 | -            $query_params = array('page' => 'espresso_about'); | 
                                                        |
| 133 | - $activation_type = $this->activation_type->getActivationType();  | 
                                                        |
| 134 | -            if ($activation_type === ActivationType::NEW_ACTIVATION) { | 
                                                        |
| 135 | - $query_params['new_activation'] = true;  | 
                                                        |
| 136 | -            } else if ($activation_type === ActivationType::REACTIVATION) { | 
                                                        |
| 137 | - $query_params['reactivation'] = true;  | 
                                                        |
| 138 | - }  | 
                                                        |
| 139 | - wp_safe_redirect(  | 
                                                        |
| 140 | -                add_query_arg($query_params, admin_url('admin.php')) | 
                                                        |
| 141 | - );  | 
                                                        |
| 142 | - }  | 
                                                        |
| 143 | - }  | 
                                                        |
| 27 | + /**  | 
                                                        |
| 28 | + * @var EE_Capabilities $capabilities  | 
                                                        |
| 29 | + */  | 
                                                        |
| 30 | + private $capabilities;  | 
                                                        |
| 31 | +  | 
                                                        |
| 32 | + /**  | 
                                                        |
| 33 | + * @var EE_Data_Migration_Manager $data_migration_manager  | 
                                                        |
| 34 | + */  | 
                                                        |
| 35 | + private $data_migration_manager;  | 
                                                        |
| 36 | +  | 
                                                        |
| 37 | + /**  | 
                                                        |
| 38 | + * @var EE_Maintenance_Mode $maintenance_mode  | 
                                                        |
| 39 | + */  | 
                                                        |
| 40 | + private $maintenance_mode;  | 
                                                        |
| 41 | +  | 
                                                        |
| 42 | + /**  | 
                                                        |
| 43 | + * @var RequestInterface $request  | 
                                                        |
| 44 | + */  | 
                                                        |
| 45 | + private $request;  | 
                                                        |
| 46 | +  | 
                                                        |
| 47 | + /**  | 
                                                        |
| 48 | + * @var ActivationType $activation_type  | 
                                                        |
| 49 | + */  | 
                                                        |
| 50 | + private $activation_type;  | 
                                                        |
| 51 | +  | 
                                                        |
| 52 | +  | 
                                                        |
| 53 | + /**  | 
                                                        |
| 54 | + * InitializeDatabase constructor.  | 
                                                        |
| 55 | + *  | 
                                                        |
| 56 | + * @param ActivationType $activation_type  | 
                                                        |
| 57 | + * @param EE_Capabilities $capabilities  | 
                                                        |
| 58 | + * @param EE_Data_Migration_Manager $data_migration_manager  | 
                                                        |
| 59 | + * @param EE_Maintenance_Mode $maintenance_mode  | 
                                                        |
| 60 | + * @param RequestInterface $request  | 
                                                        |
| 61 | + */  | 
                                                        |
| 62 | + public function __construct(  | 
                                                        |
| 63 | + ActivationType $activation_type,  | 
                                                        |
| 64 | + EE_Capabilities $capabilities,  | 
                                                        |
| 65 | + EE_Data_Migration_Manager $data_migration_manager,  | 
                                                        |
| 66 | + EE_Maintenance_Mode $maintenance_mode,  | 
                                                        |
| 67 | + RequestInterface $request  | 
                                                        |
| 68 | +	) { | 
                                                        |
| 69 | + $this->activation_type = $activation_type;  | 
                                                        |
| 70 | + $this->capabilities = $capabilities;  | 
                                                        |
| 71 | + $this->data_migration_manager = $data_migration_manager;  | 
                                                        |
| 72 | + $this->maintenance_mode = $maintenance_mode;  | 
                                                        |
| 73 | + $this->request = $request;  | 
                                                        |
| 74 | + }  | 
                                                        |
| 75 | +  | 
                                                        |
| 76 | +  | 
                                                        |
| 77 | +  | 
                                                        |
| 78 | +  | 
                                                        |
| 79 | + /**  | 
                                                        |
| 80 | + * @param bool $verify_schema  | 
                                                        |
| 81 | + * @return void  | 
                                                        |
| 82 | + * @throws \EE_Error  | 
                                                        |
| 83 | + */  | 
                                                        |
| 84 | + public function initialize($verify_schema = true)  | 
                                                        |
| 85 | +	{ | 
                                                        |
| 86 | + $activation_type = $this->activation_type->getActivationType();  | 
                                                        |
| 87 | + //only initialize system if we're not in maintenance mode.  | 
                                                        |
| 88 | +		if ($this->maintenance_mode->level() !== EE_Maintenance_Mode::level_2_complete_maintenance) { | 
                                                        |
| 89 | +			update_option('ee_flush_rewrite_rules', true); | 
                                                        |
| 90 | +			if ($verify_schema) { | 
                                                        |
| 91 | + // first check if we had previously attempted to setup EE's directories but failed  | 
                                                        |
| 92 | +				if (EEH_Activation::upload_directories_incomplete()) { | 
                                                        |
| 93 | + EEH_Activation::create_upload_directories();  | 
                                                        |
| 94 | + }  | 
                                                        |
| 95 | + EEH_Activation::initialize_db_and_folders();  | 
                                                        |
| 96 | + }  | 
                                                        |
| 97 | + EEH_Activation::initialize_db_content();  | 
                                                        |
| 98 | + EEH_Activation::system_initialization();  | 
                                                        |
| 99 | +		} else { | 
                                                        |
| 100 | +			$this->data_migration_manager->enqueue_db_initialization_for('Core'); | 
                                                        |
| 101 | + }  | 
                                                        |
| 102 | + if ($activation_type === ActivationType::NEW_ACTIVATION  | 
                                                        |
| 103 | + || $activation_type === ActivationType::REACTIVATION  | 
                                                        |
| 104 | + || (  | 
                                                        |
| 105 | + $activation_type === ActivationType::UPGRADE  | 
                                                        |
| 106 | + && $this->activation_type->isMajorVersionChange()  | 
                                                        |
| 107 | + )  | 
                                                        |
| 108 | +		) { | 
                                                        |
| 109 | +			add_action('init', array($this, 'redirectToAboutPage'), 1); | 
                                                        |
| 110 | + }  | 
                                                        |
| 111 | + }  | 
                                                        |
| 112 | +  | 
                                                        |
| 113 | +  | 
                                                        |
| 114 | +  | 
                                                        |
| 115 | +  | 
                                                        |
| 116 | + /**  | 
                                                        |
| 117 | + * This redirects to the about EE page after activation  | 
                                                        |
| 118 | + *  | 
                                                        |
| 119 | + * @return void  | 
                                                        |
| 120 | + */  | 
                                                        |
| 121 | + public function redirectToAboutPage()  | 
                                                        |
| 122 | +	{ | 
                                                        |
| 123 | + //if current user is an admin and it's not an ajax or rest request  | 
                                                        |
| 124 | + if (  | 
                                                        |
| 125 | + $this->request->isAdmin()  | 
                                                        |
| 126 | + && EE_Error::has_notices() !== 1  | 
                                                        |
| 127 | + && apply_filters(  | 
                                                        |
| 128 | + 'FHEE__EE_System__redirect_to_about_ee__do_redirect',  | 
                                                        |
| 129 | +				$this->capabilities->current_user_can('manage_options', 'espresso_about_default') | 
                                                        |
| 130 | + )  | 
                                                        |
| 131 | +		) { | 
                                                        |
| 132 | +			$query_params = array('page' => 'espresso_about'); | 
                                                        |
| 133 | + $activation_type = $this->activation_type->getActivationType();  | 
                                                        |
| 134 | +			if ($activation_type === ActivationType::NEW_ACTIVATION) { | 
                                                        |
| 135 | + $query_params['new_activation'] = true;  | 
                                                        |
| 136 | +			} else if ($activation_type === ActivationType::REACTIVATION) { | 
                                                        |
| 137 | + $query_params['reactivation'] = true;  | 
                                                        |
| 138 | + }  | 
                                                        |
| 139 | + wp_safe_redirect(  | 
                                                        |
| 140 | +				add_query_arg($query_params, admin_url('admin.php')) | 
                                                        |
| 141 | + );  | 
                                                        |
| 142 | + }  | 
                                                        |
| 143 | + }  | 
                                                        |
| 144 | 144 | }  | 
                                                        
@@ -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,857 +25,857 @@ 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 | - * @type RequestInterface $request  | 
                                                        |
| 66 | - */  | 
                                                        |
| 67 | - protected $request;  | 
                                                        |
| 68 | -  | 
                                                        |
| 69 | - /**  | 
                                                        |
| 70 | - * @type LegacyRequestInterface $legacy_request  | 
                                                        |
| 71 | - */  | 
                                                        |
| 72 | - protected $legacy_request;  | 
                                                        |
| 73 | -  | 
                                                        |
| 74 | - /**  | 
                                                        |
| 75 | - * @type ResponseInterface $response  | 
                                                        |
| 76 | - */  | 
                                                        |
| 77 | - protected $response;  | 
                                                        |
| 78 | -  | 
                                                        |
| 79 | - /**  | 
                                                        |
| 80 | - * @type LoaderInterface $loader  | 
                                                        |
| 81 | - */  | 
                                                        |
| 82 | - protected $loader;  | 
                                                        |
| 83 | -  | 
                                                        |
| 84 | - /**  | 
                                                        |
| 85 | - * @type array $_dependency_map  | 
                                                        |
| 86 | - */  | 
                                                        |
| 87 | - protected $_dependency_map = array();  | 
                                                        |
| 88 | -  | 
                                                        |
| 89 | - /**  | 
                                                        |
| 90 | - * @type array $_class_loaders  | 
                                                        |
| 91 | - */  | 
                                                        |
| 92 | - protected $_class_loaders = array();  | 
                                                        |
| 93 | -  | 
                                                        |
| 94 | - /**  | 
                                                        |
| 95 | - * @type array $_aliases  | 
                                                        |
| 96 | - */  | 
                                                        |
| 97 | - protected $_aliases = array();  | 
                                                        |
| 98 | -  | 
                                                        |
| 99 | -  | 
                                                        |
| 100 | -  | 
                                                        |
| 101 | - /**  | 
                                                        |
| 102 | - * EE_Dependency_Map constructor.  | 
                                                        |
| 103 | - */  | 
                                                        |
| 104 | - protected function __construct()  | 
                                                        |
| 105 | -    { | 
                                                        |
| 106 | -        // add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize')); | 
                                                        |
| 107 | -        do_action('EE_Dependency_Map____construct'); | 
                                                        |
| 108 | - }  | 
                                                        |
| 109 | -  | 
                                                        |
| 110 | -  | 
                                                        |
| 111 | -  | 
                                                        |
| 112 | - /**  | 
                                                        |
| 113 | - * @throws InvalidDataTypeException  | 
                                                        |
| 114 | - * @throws InvalidInterfaceException  | 
                                                        |
| 115 | - * @throws InvalidArgumentException  | 
                                                        |
| 116 | - */  | 
                                                        |
| 117 | - public function initialize()  | 
                                                        |
| 118 | -    { | 
                                                        |
| 119 | - $this->_register_core_dependencies();  | 
                                                        |
| 120 | - $this->_register_core_class_loaders();  | 
                                                        |
| 121 | - $this->_register_core_aliases();  | 
                                                        |
| 122 | - }  | 
                                                        |
| 123 | -  | 
                                                        |
| 124 | -  | 
                                                        |
| 125 | -  | 
                                                        |
| 126 | - /**  | 
                                                        |
| 127 | - * @singleton method used to instantiate class object  | 
                                                        |
| 128 | - * @return EE_Dependency_Map  | 
                                                        |
| 129 | - */  | 
                                                        |
| 130 | -    public static function instance() { | 
                                                        |
| 131 | - // check if class object is instantiated, and instantiated properly  | 
                                                        |
| 132 | -        if (! self::$_instance instanceof EE_Dependency_Map) { | 
                                                        |
| 133 | - self::$_instance = new EE_Dependency_Map(/*$request, $response, $legacy_request*/);  | 
                                                        |
| 134 | - }  | 
                                                        |
| 135 | - return self::$_instance;  | 
                                                        |
| 136 | - }  | 
                                                        |
| 137 | -  | 
                                                        |
| 138 | -  | 
                                                        |
| 139 | - /**  | 
                                                        |
| 140 | - * @param RequestInterface $request  | 
                                                        |
| 141 | - */  | 
                                                        |
| 142 | - public function setRequest(RequestInterface $request)  | 
                                                        |
| 143 | -    { | 
                                                        |
| 144 | - $this->request = $request;  | 
                                                        |
| 145 | - }  | 
                                                        |
| 146 | -  | 
                                                        |
| 147 | -  | 
                                                        |
| 148 | - /**  | 
                                                        |
| 149 | - * @param LegacyRequestInterface $legacy_request  | 
                                                        |
| 150 | - */  | 
                                                        |
| 151 | - public function setLegacyRequest(LegacyRequestInterface $legacy_request)  | 
                                                        |
| 152 | -    { | 
                                                        |
| 153 | - $this->legacy_request = $legacy_request;  | 
                                                        |
| 154 | - }  | 
                                                        |
| 155 | -  | 
                                                        |
| 156 | -  | 
                                                        |
| 157 | - /**  | 
                                                        |
| 158 | - * @param ResponseInterface $response  | 
                                                        |
| 159 | - */  | 
                                                        |
| 160 | - public function setResponse(ResponseInterface $response)  | 
                                                        |
| 161 | -    { | 
                                                        |
| 162 | - $this->response = $response;  | 
                                                        |
| 163 | - }  | 
                                                        |
| 164 | -  | 
                                                        |
| 165 | -  | 
                                                        |
| 166 | -  | 
                                                        |
| 167 | - /**  | 
                                                        |
| 168 | - * @param LoaderInterface $loader  | 
                                                        |
| 169 | - */  | 
                                                        |
| 170 | - public function setLoader(LoaderInterface $loader)  | 
                                                        |
| 171 | -    { | 
                                                        |
| 172 | - $this->loader = $loader;  | 
                                                        |
| 173 | - }  | 
                                                        |
| 174 | -  | 
                                                        |
| 175 | -  | 
                                                        |
| 176 | -  | 
                                                        |
| 177 | - /**  | 
                                                        |
| 178 | - * @param string $class  | 
                                                        |
| 179 | - * @param array $dependencies  | 
                                                        |
| 180 | - * @param int $overwrite  | 
                                                        |
| 181 | - * @return bool  | 
                                                        |
| 182 | - */  | 
                                                        |
| 183 | - public static function register_dependencies(  | 
                                                        |
| 184 | - $class,  | 
                                                        |
| 185 | - array $dependencies,  | 
                                                        |
| 186 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES  | 
                                                        |
| 187 | -    ) { | 
                                                        |
| 188 | - return self::$_instance->registerDependencies($class, $dependencies, $overwrite);  | 
                                                        |
| 189 | - }  | 
                                                        |
| 190 | -  | 
                                                        |
| 191 | -  | 
                                                        |
| 192 | -  | 
                                                        |
| 193 | - /**  | 
                                                        |
| 194 | - * Assigns an array of class names and corresponding load sources (new or cached)  | 
                                                        |
| 195 | - * to the class specified by the first parameter.  | 
                                                        |
| 196 | - * IMPORTANT !!!  | 
                                                        |
| 197 | - * The order of elements in the incoming $dependencies array MUST match  | 
                                                        |
| 198 | - * the order of the constructor parameters for the class in question.  | 
                                                        |
| 199 | - * This is especially important when overriding any existing dependencies that are registered.  | 
                                                        |
| 200 | - * the third parameter controls whether any duplicate dependencies are overwritten or not.  | 
                                                        |
| 201 | - *  | 
                                                        |
| 202 | - * @param string $class  | 
                                                        |
| 203 | - * @param array $dependencies  | 
                                                        |
| 204 | - * @param int $overwrite  | 
                                                        |
| 205 | - * @return bool  | 
                                                        |
| 206 | - */  | 
                                                        |
| 207 | - public function registerDependencies(  | 
                                                        |
| 208 | - $class,  | 
                                                        |
| 209 | - array $dependencies,  | 
                                                        |
| 210 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES  | 
                                                        |
| 211 | -    ) { | 
                                                        |
| 212 | - $class = trim($class, '\\');  | 
                                                        |
| 213 | - $registered = false;  | 
                                                        |
| 214 | -        if (empty(self::$_instance->_dependency_map[ $class ])) { | 
                                                        |
| 215 | - self::$_instance->_dependency_map[ $class ] = array();  | 
                                                        |
| 216 | - }  | 
                                                        |
| 217 | - // we need to make sure that any aliases used when registering a dependency  | 
                                                        |
| 218 | - // get resolved to the correct class name  | 
                                                        |
| 219 | -        foreach ($dependencies as $dependency => $load_source) { | 
                                                        |
| 220 | - $alias = self::$_instance->get_alias($dependency);  | 
                                                        |
| 221 | - if (  | 
                                                        |
| 222 | - $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES  | 
                                                        |
| 223 | - || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ])  | 
                                                        |
| 224 | -            ) { | 
                                                        |
| 225 | - unset($dependencies[$dependency]);  | 
                                                        |
| 226 | - $dependencies[$alias] = $load_source;  | 
                                                        |
| 227 | - $registered = true;  | 
                                                        |
| 228 | - }  | 
                                                        |
| 229 | - }  | 
                                                        |
| 230 | - // now add our two lists of dependencies together.  | 
                                                        |
| 231 | - // using Union (+=) favours the arrays in precedence from left to right,  | 
                                                        |
| 232 | - // so $dependencies is NOT overwritten because it is listed first  | 
                                                        |
| 233 | - // ie: with A = B + C, entries in B take precedence over duplicate entries in C  | 
                                                        |
| 234 | - // Union is way faster than array_merge() but should be used with caution...  | 
                                                        |
| 235 | - // especially with numerically indexed arrays  | 
                                                        |
| 236 | - $dependencies += self::$_instance->_dependency_map[ $class ];  | 
                                                        |
| 237 | - // now we need to ensure that the resulting dependencies  | 
                                                        |
| 238 | - // array only has the entries that are required for the class  | 
                                                        |
| 239 | - // so first count how many dependencies were originally registered for the class  | 
                                                        |
| 240 | - $dependency_count = count(self::$_instance->_dependency_map[ $class ]);  | 
                                                        |
| 241 | - // if that count is non-zero (meaning dependencies were already registered)  | 
                                                        |
| 242 | - self::$_instance->_dependency_map[ $class ] = $dependency_count  | 
                                                        |
| 243 | - // then truncate the final array to match that count  | 
                                                        |
| 244 | - ? array_slice($dependencies, 0, $dependency_count)  | 
                                                        |
| 245 | - // otherwise just take the incoming array because nothing previously existed  | 
                                                        |
| 246 | - : $dependencies;  | 
                                                        |
| 247 | - return $registered;  | 
                                                        |
| 248 | - }  | 
                                                        |
| 249 | -  | 
                                                        |
| 250 | -  | 
                                                        |
| 251 | -  | 
                                                        |
| 252 | - /**  | 
                                                        |
| 253 | - * @param string $class_name  | 
                                                        |
| 254 | - * @param string $loader  | 
                                                        |
| 255 | - * @return bool  | 
                                                        |
| 256 | - * @throws DomainException  | 
                                                        |
| 257 | - */  | 
                                                        |
| 258 | - public static function register_class_loader($class_name, $loader = 'load_core')  | 
                                                        |
| 259 | -    { | 
                                                        |
| 260 | -        if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { | 
                                                        |
| 261 | - throw new DomainException(  | 
                                                        |
| 262 | -                esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') | 
                                                        |
| 263 | - );  | 
                                                        |
| 264 | - }  | 
                                                        |
| 265 | - // check that loader is callable or method starts with "load_" and exists in EE_Registry  | 
                                                        |
| 266 | - if (  | 
                                                        |
| 267 | - ! is_callable($loader)  | 
                                                        |
| 268 | - && (  | 
                                                        |
| 269 | - strpos($loader, 'load_') !== 0  | 
                                                        |
| 270 | -                || ! method_exists('EE_Registry', $loader) | 
                                                        |
| 271 | - )  | 
                                                        |
| 272 | -        ) { | 
                                                        |
| 273 | - throw new DomainException(  | 
                                                        |
| 274 | - sprintf(  | 
                                                        |
| 275 | - esc_html__(  | 
                                                        |
| 276 | - '"%1$s" is not a valid loader method on EE_Registry.',  | 
                                                        |
| 277 | - 'event_espresso'  | 
                                                        |
| 278 | - ),  | 
                                                        |
| 279 | - $loader  | 
                                                        |
| 280 | - )  | 
                                                        |
| 281 | - );  | 
                                                        |
| 282 | - }  | 
                                                        |
| 283 | - $class_name = self::$_instance->get_alias($class_name);  | 
                                                        |
| 284 | -        if (! isset(self::$_instance->_class_loaders[$class_name])) { | 
                                                        |
| 285 | - self::$_instance->_class_loaders[$class_name] = $loader;  | 
                                                        |
| 286 | - return true;  | 
                                                        |
| 287 | - }  | 
                                                        |
| 288 | - return false;  | 
                                                        |
| 289 | - }  | 
                                                        |
| 290 | -  | 
                                                        |
| 291 | -  | 
                                                        |
| 292 | -  | 
                                                        |
| 293 | - /**  | 
                                                        |
| 294 | - * @return array  | 
                                                        |
| 295 | - */  | 
                                                        |
| 296 | - public function dependency_map()  | 
                                                        |
| 297 | -    { | 
                                                        |
| 298 | - return $this->_dependency_map;  | 
                                                        |
| 299 | - }  | 
                                                        |
| 300 | -  | 
                                                        |
| 301 | -  | 
                                                        |
| 302 | -  | 
                                                        |
| 303 | - /**  | 
                                                        |
| 304 | - * returns TRUE if dependency map contains a listing for the provided class name  | 
                                                        |
| 305 | - *  | 
                                                        |
| 306 | - * @param string $class_name  | 
                                                        |
| 307 | - * @return boolean  | 
                                                        |
| 308 | - */  | 
                                                        |
| 309 | - public function has($class_name = '')  | 
                                                        |
| 310 | -    { | 
                                                        |
| 311 | - // all legacy models have the same dependencies  | 
                                                        |
| 312 | -        if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 313 | - $class_name = 'LEGACY_MODELS';  | 
                                                        |
| 314 | - }  | 
                                                        |
| 315 | - return isset($this->_dependency_map[$class_name]) ? true : false;  | 
                                                        |
| 316 | - }  | 
                                                        |
| 317 | -  | 
                                                        |
| 318 | -  | 
                                                        |
| 319 | -  | 
                                                        |
| 320 | - /**  | 
                                                        |
| 321 | - * returns TRUE if dependency map contains a listing for the provided class name AND dependency  | 
                                                        |
| 322 | - *  | 
                                                        |
| 323 | - * @param string $class_name  | 
                                                        |
| 324 | - * @param string $dependency  | 
                                                        |
| 325 | - * @return bool  | 
                                                        |
| 326 | - */  | 
                                                        |
| 327 | - public function has_dependency_for_class($class_name = '', $dependency = '')  | 
                                                        |
| 328 | -    { | 
                                                        |
| 329 | - // all legacy models have the same dependencies  | 
                                                        |
| 330 | -        if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 331 | - $class_name = 'LEGACY_MODELS';  | 
                                                        |
| 332 | - }  | 
                                                        |
| 333 | - $dependency = $this->get_alias($dependency);  | 
                                                        |
| 334 | - return isset($this->_dependency_map[$class_name][$dependency])  | 
                                                        |
| 335 | - ? true  | 
                                                        |
| 336 | - : false;  | 
                                                        |
| 337 | - }  | 
                                                        |
| 338 | -  | 
                                                        |
| 339 | -  | 
                                                        |
| 340 | -  | 
                                                        |
| 341 | - /**  | 
                                                        |
| 342 | - * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned  | 
                                                        |
| 343 | - *  | 
                                                        |
| 344 | - * @param string $class_name  | 
                                                        |
| 345 | - * @param string $dependency  | 
                                                        |
| 346 | - * @return int  | 
                                                        |
| 347 | - */  | 
                                                        |
| 348 | - public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')  | 
                                                        |
| 349 | -    { | 
                                                        |
| 350 | - // all legacy models have the same dependencies  | 
                                                        |
| 351 | -        if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 352 | - $class_name = 'LEGACY_MODELS';  | 
                                                        |
| 353 | - }  | 
                                                        |
| 354 | - $dependency = $this->get_alias($dependency);  | 
                                                        |
| 355 | - return $this->has_dependency_for_class($class_name, $dependency)  | 
                                                        |
| 356 | - ? $this->_dependency_map[$class_name][$dependency]  | 
                                                        |
| 357 | - : EE_Dependency_Map::not_registered;  | 
                                                        |
| 358 | - }  | 
                                                        |
| 359 | -  | 
                                                        |
| 360 | -  | 
                                                        |
| 361 | -  | 
                                                        |
| 362 | - /**  | 
                                                        |
| 363 | - * @param string $class_name  | 
                                                        |
| 364 | - * @return string | Closure  | 
                                                        |
| 365 | - */  | 
                                                        |
| 366 | - public function class_loader($class_name)  | 
                                                        |
| 367 | -    { | 
                                                        |
| 368 | - // all legacy models use load_model()  | 
                                                        |
| 369 | -        if(strpos($class_name, 'EEM_') === 0){ | 
                                                        |
| 370 | - return 'load_model';  | 
                                                        |
| 371 | - }  | 
                                                        |
| 372 | - $class_name = $this->get_alias($class_name);  | 
                                                        |
| 373 | - return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : '';  | 
                                                        |
| 374 | - }  | 
                                                        |
| 375 | -  | 
                                                        |
| 376 | -  | 
                                                        |
| 377 | -  | 
                                                        |
| 378 | - /**  | 
                                                        |
| 379 | - * @return array  | 
                                                        |
| 380 | - */  | 
                                                        |
| 381 | - public function class_loaders()  | 
                                                        |
| 382 | -    { | 
                                                        |
| 383 | - return $this->_class_loaders;  | 
                                                        |
| 384 | - }  | 
                                                        |
| 385 | -  | 
                                                        |
| 386 | -  | 
                                                        |
| 387 | -  | 
                                                        |
| 388 | - /**  | 
                                                        |
| 389 | - * adds an alias for a classname  | 
                                                        |
| 390 | - *  | 
                                                        |
| 391 | - * @param string $class_name the class name that should be used (concrete class to replace interface)  | 
                                                        |
| 392 | - * @param string $alias the class name that would be type hinted for (abstract parent or interface)  | 
                                                        |
| 393 | - * @param string $for_class the class that has the dependency (is type hinting for the interface)  | 
                                                        |
| 394 | - */  | 
                                                        |
| 395 | - public function add_alias($class_name, $alias, $for_class = '')  | 
                                                        |
| 396 | -    { | 
                                                        |
| 397 | -        if ($for_class !== '') { | 
                                                        |
| 398 | -            if (! isset($this->_aliases[$for_class])) { | 
                                                        |
| 399 | - $this->_aliases[$for_class] = array();  | 
                                                        |
| 400 | - }  | 
                                                        |
| 401 | - $this->_aliases[$for_class][$class_name] = $alias;  | 
                                                        |
| 402 | - }  | 
                                                        |
| 403 | - $this->_aliases[$class_name] = $alias;  | 
                                                        |
| 404 | - }  | 
                                                        |
| 405 | -  | 
                                                        |
| 406 | -  | 
                                                        |
| 407 | -  | 
                                                        |
| 408 | - /**  | 
                                                        |
| 409 | - * returns TRUE if the provided class name has an alias  | 
                                                        |
| 410 | - *  | 
                                                        |
| 411 | - * @param string $class_name  | 
                                                        |
| 412 | - * @param string $for_class  | 
                                                        |
| 413 | - * @return bool  | 
                                                        |
| 414 | - */  | 
                                                        |
| 415 | - public function has_alias($class_name = '', $for_class = '')  | 
                                                        |
| 416 | -    { | 
                                                        |
| 417 | - return isset($this->_aliases[$for_class][$class_name])  | 
                                                        |
| 418 | - || (  | 
                                                        |
| 419 | - isset($this->_aliases[$class_name])  | 
                                                        |
| 420 | - && ! is_array($this->_aliases[$class_name])  | 
                                                        |
| 421 | - );  | 
                                                        |
| 422 | - }  | 
                                                        |
| 423 | -  | 
                                                        |
| 424 | -  | 
                                                        |
| 425 | -  | 
                                                        |
| 426 | - /**  | 
                                                        |
| 427 | - * returns alias for class name if one exists, otherwise returns the original classname  | 
                                                        |
| 428 | - * functions recursively, so that multiple aliases can be used to drill down to a classname  | 
                                                        |
| 429 | - * for example:  | 
                                                        |
| 430 | - * if the following two entries were added to the _aliases array:  | 
                                                        |
| 431 | - * array(  | 
                                                        |
| 432 | - * 'interface_alias' => 'some\namespace\interface'  | 
                                                        |
| 433 | - * 'some\namespace\interface' => 'some\namespace\classname'  | 
                                                        |
| 434 | - * )  | 
                                                        |
| 435 | - * then one could use EE_Registry::instance()->create( 'interface_alias' )  | 
                                                        |
| 436 | - * to load an instance of 'some\namespace\classname'  | 
                                                        |
| 437 | - *  | 
                                                        |
| 438 | - * @param string $class_name  | 
                                                        |
| 439 | - * @param string $for_class  | 
                                                        |
| 440 | - * @return string  | 
                                                        |
| 441 | - */  | 
                                                        |
| 442 | - public function get_alias($class_name = '', $for_class = '')  | 
                                                        |
| 443 | -    { | 
                                                        |
| 444 | -        if (! $this->has_alias($class_name, $for_class)) { | 
                                                        |
| 445 | - return $class_name;  | 
                                                        |
| 446 | - }  | 
                                                        |
| 447 | -        if ($for_class !== '' && isset($this->_aliases[ $for_class ][ $class_name ])) { | 
                                                        |
| 448 | - return $this->get_alias($this->_aliases[$for_class][$class_name], $for_class);  | 
                                                        |
| 449 | - }  | 
                                                        |
| 450 | - return $this->get_alias($this->_aliases[$class_name]);  | 
                                                        |
| 451 | - }  | 
                                                        |
| 452 | -  | 
                                                        |
| 453 | -  | 
                                                        |
| 454 | -  | 
                                                        |
| 455 | - /**  | 
                                                        |
| 456 | - * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,  | 
                                                        |
| 457 | - * if one exists, or whether a new object should be generated every time the requested class is loaded.  | 
                                                        |
| 458 | - * This is done by using the following class constants:  | 
                                                        |
| 459 | - * EE_Dependency_Map::load_from_cache - loads previously instantiated object  | 
                                                        |
| 460 | - * EE_Dependency_Map::load_new_object - generates a new object every time  | 
                                                        |
| 461 | - */  | 
                                                        |
| 462 | - protected function _register_core_dependencies()  | 
                                                        |
| 463 | -    { | 
                                                        |
| 464 | - $this->_dependency_map = array(  | 
                                                        |
| 465 | - 'EE_Request_Handler' => array(  | 
                                                        |
| 466 | - 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 467 | - ),  | 
                                                        |
| 468 | - 'EE_System' => array(  | 
                                                        |
| 469 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 470 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 471 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 472 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 473 | - ),  | 
                                                        |
| 474 | - 'EE_Session' => array(  | 
                                                        |
| 475 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 476 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 477 | - 'EE_Encryption' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 478 | - ),  | 
                                                        |
| 479 | - 'EE_Cart' => array(  | 
                                                        |
| 480 | - 'EE_Session' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 481 | - ),  | 
                                                        |
| 482 | - 'EE_Front_Controller' => array(  | 
                                                        |
| 483 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 484 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 485 | - 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 486 | - ),  | 
                                                        |
| 487 | - 'EE_Messenger_Collection_Loader' => array(  | 
                                                        |
| 488 | - 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 489 | - ),  | 
                                                        |
| 490 | - 'EE_Message_Type_Collection_Loader' => array(  | 
                                                        |
| 491 | - 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 492 | - ),  | 
                                                        |
| 493 | - 'EE_Message_Resource_Manager' => array(  | 
                                                        |
| 494 | - 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 495 | - 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 496 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 497 | - ),  | 
                                                        |
| 498 | - 'EE_Message_Factory' => array(  | 
                                                        |
| 499 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 500 | - ),  | 
                                                        |
| 501 | - 'EE_messages' => array(  | 
                                                        |
| 502 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 503 | - ),  | 
                                                        |
| 504 | - 'EE_Messages_Generator' => array(  | 
                                                        |
| 505 | - 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 506 | - 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 507 | - 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 508 | - 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 509 | - ),  | 
                                                        |
| 510 | - 'EE_Messages_Processor' => array(  | 
                                                        |
| 511 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 512 | - ),  | 
                                                        |
| 513 | - 'EE_Messages_Queue' => array(  | 
                                                        |
| 514 | - 'EE_Message_Repository' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 515 | - ),  | 
                                                        |
| 516 | - 'EE_Messages_Template_Defaults' => array(  | 
                                                        |
| 517 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 518 | - 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 519 | - ),  | 
                                                        |
| 520 | - 'EE_Message_To_Generate_From_Request' => array(  | 
                                                        |
| 521 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 522 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 523 | - ),  | 
                                                        |
| 524 | - 'EventEspresso\core\services\commands\CommandBus' => array(  | 
                                                        |
| 525 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 526 | - ),  | 
                                                        |
| 527 | - 'EventEspresso\services\commands\CommandHandler' => array(  | 
                                                        |
| 528 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 529 | - 'CommandBusInterface' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 530 | - ),  | 
                                                        |
| 531 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => array(  | 
                                                        |
| 532 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 533 | - ),  | 
                                                        |
| 534 | - 'EventEspresso\core\services\commands\CompositeCommandHandler' => array(  | 
                                                        |
| 535 | - 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 536 | - 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 537 | - ),  | 
                                                        |
| 538 | - 'EventEspresso\core\services\commands\CommandFactory' => array(  | 
                                                        |
| 539 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 540 | - ),  | 
                                                        |
| 541 | - 'EventEspresso\core\services\commands\middleware\CapChecker' => array(  | 
                                                        |
| 542 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 543 | - ),  | 
                                                        |
| 544 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => array(  | 
                                                        |
| 545 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 546 | - ),  | 
                                                        |
| 547 | - 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => array(  | 
                                                        |
| 548 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 549 | - ),  | 
                                                        |
| 550 | - 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => array(  | 
                                                        |
| 551 | - 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 552 | - ),  | 
                                                        |
| 553 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => array(  | 
                                                        |
| 554 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 555 | - ),  | 
                                                        |
| 556 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => array(  | 
                                                        |
| 557 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 558 | - ),  | 
                                                        |
| 559 | - 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => array(  | 
                                                        |
| 560 | - 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 561 | - ),  | 
                                                        |
| 562 | - 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array(  | 
                                                        |
| 563 | - 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 564 | - ),  | 
                                                        |
| 565 | - 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => array(  | 
                                                        |
| 566 | - 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 567 | - ),  | 
                                                        |
| 568 | - 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => array(  | 
                                                        |
| 569 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 570 | - ),  | 
                                                        |
| 571 | - 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => array(  | 
                                                        |
| 572 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 573 | - ),  | 
                                                        |
| 574 | - 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => array(  | 
                                                        |
| 575 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 576 | - ),  | 
                                                        |
| 577 | - 'EventEspresso\core\services\database\TableManager' => array(  | 
                                                        |
| 578 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 579 | - ),  | 
                                                        |
| 580 | - 'EE_Data_Migration_Class_Base' => 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_1_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_2_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_3_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_4_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_5_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_6_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 | - 'EE_DMS_Core_4_7_0' => array(  | 
                                                        |
| 609 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 610 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 611 | - ),  | 
                                                        |
| 612 | - 'EE_DMS_Core_4_8_0' => array(  | 
                                                        |
| 613 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 614 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 615 | - ),  | 
                                                        |
| 616 | - 'EE_DMS_Core_4_9_0' => array(  | 
                                                        |
| 617 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 618 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 619 | - ),  | 
                                                        |
| 620 | - 'EventEspresso\core\services\assets\Registry' => array(  | 
                                                        |
| 621 | - 'EE_Template_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 622 | - 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 623 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 624 | - ),  | 
                                                        |
| 625 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => array(  | 
                                                        |
| 626 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 627 | - ),  | 
                                                        |
| 628 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => array(  | 
                                                        |
| 629 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 630 | - ),  | 
                                                        |
| 631 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => array(  | 
                                                        |
| 632 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 633 | - ),  | 
                                                        |
| 634 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => array(  | 
                                                        |
| 635 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 636 | - ),  | 
                                                        |
| 637 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => array(  | 
                                                        |
| 638 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 639 | - ),  | 
                                                        |
| 640 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => array(  | 
                                                        |
| 641 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 642 | - ),  | 
                                                        |
| 643 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => array(  | 
                                                        |
| 644 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 645 | - ),  | 
                                                        |
| 646 | - 'EventEspresso\core\services\cache\BasicCacheManager' => array(  | 
                                                        |
| 647 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 648 | - ),  | 
                                                        |
| 649 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => array(  | 
                                                        |
| 650 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 651 | - ),  | 
                                                        |
| 652 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => array(  | 
                                                        |
| 653 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 654 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 655 | - ),  | 
                                                        |
| 656 | - 'EventEspresso\core\domain\values\EmailAddress' => array(  | 
                                                        |
| 657 | - null,  | 
                                                        |
| 658 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 659 | - ),  | 
                                                        |
| 660 | - 'EventEspresso\core\services\orm\ModelFieldFactory' => array(  | 
                                                        |
| 661 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 662 | - ),  | 
                                                        |
| 663 | - 'LEGACY_MODELS' => array(  | 
                                                        |
| 664 | - null,  | 
                                                        |
| 665 | - 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 666 | - ),  | 
                                                        |
| 667 | - 'EventEspresso\core\services\activation\ActivationsAndUpgradesManager' => array(  | 
                                                        |
| 668 | - 'EventEspresso\core\services\activation\ActivationHandler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 669 | - 'EventEspresso\core\services\activation\ActivationTypeDetector' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 670 | - ),  | 
                                                        |
| 671 | - 'EventEspresso\core\services\activation\ActivationHandler' => array(  | 
                                                        |
| 672 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 673 | - ),  | 
                                                        |
| 674 | - 'EventEspresso\core\services\activation\InitializeCore' => array(  | 
                                                        |
| 675 | - null,  | 
                                                        |
| 676 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 677 | - 'EE_Data_Migration_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 678 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 679 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 680 | - ),  | 
                                                        |
| 681 | - 'EventEspresso\core\services\activation\InitializeAddon' => array(  | 
                                                        |
| 682 | - null,  | 
                                                        |
| 683 | - 'EE_Data_Migration_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 684 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 685 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 686 | - ),  | 
                                                        |
| 687 | - 'EE_Module_Request_Router' => array(  | 
                                                        |
| 688 | - 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 689 | - ),  | 
                                                        |
| 690 | - 'EE_Registration_Processor' => array(  | 
                                                        |
| 691 | - 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 692 | - ),  | 
                                                        |
| 693 | - 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => array(  | 
                                                        |
| 694 | - null,  | 
                                                        |
| 695 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 696 | - 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 697 | - ),  | 
                                                        |
| 698 | - );  | 
                                                        |
| 699 | - }  | 
                                                        |
| 700 | -  | 
                                                        |
| 701 | -  | 
                                                        |
| 702 | -  | 
                                                        |
| 703 | - /**  | 
                                                        |
| 704 | - * Registers how core classes are loaded.  | 
                                                        |
| 705 | - * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:  | 
                                                        |
| 706 | - * 'EE_Request_Handler' => 'load_core'  | 
                                                        |
| 707 | - * 'EE_Messages_Queue' => 'load_lib'  | 
                                                        |
| 708 | - * 'EEH_Debug_Tools' => 'load_helper'  | 
                                                        |
| 709 | - * or, if greater control is required, by providing a custom closure. For example:  | 
                                                        |
| 710 | -     *        'Some_Class' => function () { | 
                                                        |
| 711 | - * return new Some_Class();  | 
                                                        |
| 712 | - * },  | 
                                                        |
| 713 | - * This is required for instantiating dependencies  | 
                                                        |
| 714 | - * where an interface has been type hinted in a class constructor. For example:  | 
                                                        |
| 715 | -     *        'Required_Interface' => function () { | 
                                                        |
| 716 | - * return new A_Class_That_Implements_Required_Interface();  | 
                                                        |
| 717 | - * },  | 
                                                        |
| 718 | - *  | 
                                                        |
| 719 | - * @throws InvalidInterfaceException  | 
                                                        |
| 720 | - * @throws InvalidDataTypeException  | 
                                                        |
| 721 | - * @throws InvalidArgumentException  | 
                                                        |
| 722 | - */  | 
                                                        |
| 723 | - protected function _register_core_class_loaders()  | 
                                                        |
| 724 | -    { | 
                                                        |
| 725 | - //for PHP5.3 compat, we need to register any properties called here in a variable because `$this` cannot  | 
                                                        |
| 726 | - //be used in a closure.  | 
                                                        |
| 727 | - $request = &$this->request;  | 
                                                        |
| 728 | - $response = &$this->response;  | 
                                                        |
| 729 | - $legacy_request = &$this->legacy_request;  | 
                                                        |
| 730 | - // $loader = &$this->loader;  | 
                                                        |
| 731 | - $this->_class_loaders = array(  | 
                                                        |
| 732 | - //load_core  | 
                                                        |
| 733 | - 'EE_Capabilities' => 'load_core',  | 
                                                        |
| 734 | - 'EE_Encryption' => 'load_core',  | 
                                                        |
| 735 | - 'EE_Front_Controller' => 'load_core',  | 
                                                        |
| 736 | - 'EE_Module_Request_Router' => 'load_core',  | 
                                                        |
| 737 | - 'EE_Registry' => 'load_core',  | 
                                                        |
| 738 | -            'EE_Request'               => function () use (&$legacy_request) { | 
                                                        |
| 739 | - return $legacy_request;  | 
                                                        |
| 740 | - },  | 
                                                        |
| 741 | -            'EventEspresso\core\services\request\Request' => function () use (&$request) { | 
                                                        |
| 742 | - return $request;  | 
                                                        |
| 743 | - },  | 
                                                        |
| 744 | -            'EventEspresso\core\services\request\Response' => function () use (&$response) { | 
                                                        |
| 745 | - return $response;  | 
                                                        |
| 746 | - },  | 
                                                        |
| 747 | - 'EE_Request_Handler' => 'load_core',  | 
                                                        |
| 748 | - 'EE_Session' => 'load_core',  | 
                                                        |
| 749 | - 'EE_Cron_Tasks' => 'load_core',  | 
                                                        |
| 750 | - 'EE_System' => 'load_core',  | 
                                                        |
| 751 | - 'EE_Maintenance_Mode' => 'load_core',  | 
                                                        |
| 752 | - 'EE_Register_CPTs' => 'load_core',  | 
                                                        |
| 753 | - 'EE_Admin' => 'load_core',  | 
                                                        |
| 754 | - 'EE_Data_Migration_Manager' => 'load_core',  | 
                                                        |
| 755 | - //load_lib  | 
                                                        |
| 756 | - 'EE_Message_Resource_Manager' => 'load_lib',  | 
                                                        |
| 757 | - 'EE_Message_Type_Collection' => 'load_lib',  | 
                                                        |
| 758 | - 'EE_Message_Type_Collection_Loader' => 'load_lib',  | 
                                                        |
| 759 | - 'EE_Messenger_Collection' => 'load_lib',  | 
                                                        |
| 760 | - 'EE_Messenger_Collection_Loader' => 'load_lib',  | 
                                                        |
| 761 | - 'EE_Messages_Processor' => 'load_lib',  | 
                                                        |
| 762 | - 'EE_Message_Repository' => 'load_lib',  | 
                                                        |
| 763 | - 'EE_Messages_Queue' => 'load_lib',  | 
                                                        |
| 764 | - 'EE_Messages_Data_Handler_Collection' => 'load_lib',  | 
                                                        |
| 765 | - 'EE_Message_Template_Group_Collection' => 'load_lib',  | 
                                                        |
| 766 | - 'EE_Payment_Method_Manager' => 'load_lib',  | 
                                                        |
| 767 | -            'EE_Messages_Generator'                => function () { | 
                                                        |
| 768 | - return EE_Registry::instance()->load_lib(  | 
                                                        |
| 769 | - 'Messages_Generator',  | 
                                                        |
| 770 | - array(),  | 
                                                        |
| 771 | - false,  | 
                                                        |
| 772 | - false  | 
                                                        |
| 773 | - );  | 
                                                        |
| 774 | - },  | 
                                                        |
| 775 | -            'EE_Messages_Template_Defaults'        => function ($arguments = array()) { | 
                                                        |
| 776 | - return EE_Registry::instance()->load_lib(  | 
                                                        |
| 777 | - 'Messages_Template_Defaults',  | 
                                                        |
| 778 | - $arguments,  | 
                                                        |
| 779 | - false,  | 
                                                        |
| 780 | - false  | 
                                                        |
| 781 | - );  | 
                                                        |
| 782 | - },  | 
                                                        |
| 783 | - //load_model  | 
                                                        |
| 784 | - // 'EEM_Attendee' => 'load_model',  | 
                                                        |
| 785 | - // 'EEM_Message_Template_Group' => 'load_model',  | 
                                                        |
| 786 | - // 'EEM_Message_Template' => 'load_model',  | 
                                                        |
| 787 | - //load_helper  | 
                                                        |
| 788 | -            'EEH_Parse_Shortcodes'                 => function () { | 
                                                        |
| 789 | -                if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { | 
                                                        |
| 790 | - return new EEH_Parse_Shortcodes();  | 
                                                        |
| 791 | - }  | 
                                                        |
| 792 | - return null;  | 
                                                        |
| 793 | - },  | 
                                                        |
| 794 | -            'EE_Template_Config'                   => function () { | 
                                                        |
| 795 | - return EE_Config::instance()->template_settings;  | 
                                                        |
| 796 | - },  | 
                                                        |
| 797 | -            'EE_Currency_Config'                   => function () { | 
                                                        |
| 798 | - return EE_Config::instance()->currency;  | 
                                                        |
| 799 | - },  | 
                                                        |
| 800 | -            'EE_Registration_Config'                   => function () { | 
                                                        |
| 801 | - return EE_Config::instance()->registration;  | 
                                                        |
| 802 | - },  | 
                                                        |
| 803 | -            'EventEspresso\core\services\loaders\Loader' => function () { | 
                                                        |
| 804 | - return LoaderFactory::getLoader();  | 
                                                        |
| 805 | - },  | 
                                                        |
| 806 | - );  | 
                                                        |
| 807 | - }  | 
                                                        |
| 808 | -  | 
                                                        |
| 809 | -  | 
                                                        |
| 810 | -  | 
                                                        |
| 811 | - /**  | 
                                                        |
| 812 | - * can be used for supplying alternate names for classes,  | 
                                                        |
| 813 | - * or for connecting interface names to instantiable classes  | 
                                                        |
| 814 | - */  | 
                                                        |
| 815 | - protected function _register_core_aliases()  | 
                                                        |
| 816 | -    { | 
                                                        |
| 817 | - $this->_aliases = array(  | 
                                                        |
| 818 | - 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface',  | 
                                                        |
| 819 | - 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus',  | 
                                                        |
| 820 | - 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',  | 
                                                        |
| 821 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager',  | 
                                                        |
| 822 | - 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker',  | 
                                                        |
| 823 | - 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook',  | 
                                                        |
| 824 | - 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',  | 
                                                        |
| 825 | - 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',  | 
                                                        |
| 826 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',  | 
                                                        |
| 827 | - 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',  | 
                                                        |
| 828 | - 'CreateRegCodeCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegCodeCommand',  | 
                                                        |
| 829 | - 'CreateRegUrlLinkCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegUrlLinkCommand',  | 
                                                        |
| 830 | - 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',  | 
                                                        |
| 831 | - 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',  | 
                                                        |
| 832 | - 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',  | 
                                                        |
| 833 | - 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',  | 
                                                        |
| 834 | - 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',  | 
                                                        |
| 835 | - 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',  | 
                                                        |
| 836 | - 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',  | 
                                                        |
| 837 | - 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',  | 
                                                        |
| 838 | - 'TableManager' => 'EventEspresso\core\services\database\TableManager',  | 
                                                        |
| 839 | - 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis',  | 
                                                        |
| 840 | - 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode',  | 
                                                        |
| 841 | - 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',  | 
                                                        |
| 842 | - 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode',  | 
                                                        |
| 843 | - 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage',  | 
                                                        |
| 844 | - 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface',  | 
                                                        |
| 845 | - 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader',  | 
                                                        |
| 846 | - 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface',  | 
                                                        |
| 847 | - 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory',  | 
                                                        |
| 848 | - 'EventEspresso\core\domain\services\session\SessionIdentifierInterface' => 'EE_Session',  | 
                                                        |
| 849 | - 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',  | 
                                                        |
| 850 | - 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',  | 
                                                        |
| 851 | - 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface',  | 
                                                        |
| 852 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',  | 
                                                        |
| 853 | - 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface',  | 
                                                        |
| 854 | - 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer',  | 
                                                        |
| 855 | - 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request',  | 
                                                        |
| 856 | - 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response',  | 
                                                        |
| 857 | - 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain',  | 
                                                        |
| 858 | - );  | 
                                                        |
| 859 | -        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { | 
                                                        |
| 860 | - $this->_aliases['EventEspresso\core\services\notices\NoticeConverterInterface'] = 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices';  | 
                                                        |
| 861 | - }  | 
                                                        |
| 862 | - }  | 
                                                        |
| 863 | -  | 
                                                        |
| 864 | -  | 
                                                        |
| 865 | -  | 
                                                        |
| 866 | - /**  | 
                                                        |
| 867 | - * This is used to reset the internal map and class_loaders to their original default state at the beginning of the  | 
                                                        |
| 868 | - * request Primarily used by unit tests.  | 
                                                        |
| 869 | - *  | 
                                                        |
| 870 | - * @throws InvalidDataTypeException  | 
                                                        |
| 871 | - * @throws InvalidInterfaceException  | 
                                                        |
| 872 | - * @throws InvalidArgumentException  | 
                                                        |
| 873 | - */  | 
                                                        |
| 874 | - public function reset()  | 
                                                        |
| 875 | -    { | 
                                                        |
| 876 | - $this->_register_core_class_loaders();  | 
                                                        |
| 877 | - $this->_register_core_dependencies();  | 
                                                        |
| 878 | - }  | 
                                                        |
| 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 | + * @type RequestInterface $request  | 
                                                        |
| 66 | + */  | 
                                                        |
| 67 | + protected $request;  | 
                                                        |
| 68 | +  | 
                                                        |
| 69 | + /**  | 
                                                        |
| 70 | + * @type LegacyRequestInterface $legacy_request  | 
                                                        |
| 71 | + */  | 
                                                        |
| 72 | + protected $legacy_request;  | 
                                                        |
| 73 | +  | 
                                                        |
| 74 | + /**  | 
                                                        |
| 75 | + * @type ResponseInterface $response  | 
                                                        |
| 76 | + */  | 
                                                        |
| 77 | + protected $response;  | 
                                                        |
| 78 | +  | 
                                                        |
| 79 | + /**  | 
                                                        |
| 80 | + * @type LoaderInterface $loader  | 
                                                        |
| 81 | + */  | 
                                                        |
| 82 | + protected $loader;  | 
                                                        |
| 83 | +  | 
                                                        |
| 84 | + /**  | 
                                                        |
| 85 | + * @type array $_dependency_map  | 
                                                        |
| 86 | + */  | 
                                                        |
| 87 | + protected $_dependency_map = array();  | 
                                                        |
| 88 | +  | 
                                                        |
| 89 | + /**  | 
                                                        |
| 90 | + * @type array $_class_loaders  | 
                                                        |
| 91 | + */  | 
                                                        |
| 92 | + protected $_class_loaders = array();  | 
                                                        |
| 93 | +  | 
                                                        |
| 94 | + /**  | 
                                                        |
| 95 | + * @type array $_aliases  | 
                                                        |
| 96 | + */  | 
                                                        |
| 97 | + protected $_aliases = array();  | 
                                                        |
| 98 | +  | 
                                                        |
| 99 | +  | 
                                                        |
| 100 | +  | 
                                                        |
| 101 | + /**  | 
                                                        |
| 102 | + * EE_Dependency_Map constructor.  | 
                                                        |
| 103 | + */  | 
                                                        |
| 104 | + protected function __construct()  | 
                                                        |
| 105 | +	{ | 
                                                        |
| 106 | +		// add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize')); | 
                                                        |
| 107 | +		do_action('EE_Dependency_Map____construct'); | 
                                                        |
| 108 | + }  | 
                                                        |
| 109 | +  | 
                                                        |
| 110 | +  | 
                                                        |
| 111 | +  | 
                                                        |
| 112 | + /**  | 
                                                        |
| 113 | + * @throws InvalidDataTypeException  | 
                                                        |
| 114 | + * @throws InvalidInterfaceException  | 
                                                        |
| 115 | + * @throws InvalidArgumentException  | 
                                                        |
| 116 | + */  | 
                                                        |
| 117 | + public function initialize()  | 
                                                        |
| 118 | +	{ | 
                                                        |
| 119 | + $this->_register_core_dependencies();  | 
                                                        |
| 120 | + $this->_register_core_class_loaders();  | 
                                                        |
| 121 | + $this->_register_core_aliases();  | 
                                                        |
| 122 | + }  | 
                                                        |
| 123 | +  | 
                                                        |
| 124 | +  | 
                                                        |
| 125 | +  | 
                                                        |
| 126 | + /**  | 
                                                        |
| 127 | + * @singleton method used to instantiate class object  | 
                                                        |
| 128 | + * @return EE_Dependency_Map  | 
                                                        |
| 129 | + */  | 
                                                        |
| 130 | +	public static function instance() { | 
                                                        |
| 131 | + // check if class object is instantiated, and instantiated properly  | 
                                                        |
| 132 | +		if (! self::$_instance instanceof EE_Dependency_Map) { | 
                                                        |
| 133 | + self::$_instance = new EE_Dependency_Map(/*$request, $response, $legacy_request*/);  | 
                                                        |
| 134 | + }  | 
                                                        |
| 135 | + return self::$_instance;  | 
                                                        |
| 136 | + }  | 
                                                        |
| 137 | +  | 
                                                        |
| 138 | +  | 
                                                        |
| 139 | + /**  | 
                                                        |
| 140 | + * @param RequestInterface $request  | 
                                                        |
| 141 | + */  | 
                                                        |
| 142 | + public function setRequest(RequestInterface $request)  | 
                                                        |
| 143 | +	{ | 
                                                        |
| 144 | + $this->request = $request;  | 
                                                        |
| 145 | + }  | 
                                                        |
| 146 | +  | 
                                                        |
| 147 | +  | 
                                                        |
| 148 | + /**  | 
                                                        |
| 149 | + * @param LegacyRequestInterface $legacy_request  | 
                                                        |
| 150 | + */  | 
                                                        |
| 151 | + public function setLegacyRequest(LegacyRequestInterface $legacy_request)  | 
                                                        |
| 152 | +	{ | 
                                                        |
| 153 | + $this->legacy_request = $legacy_request;  | 
                                                        |
| 154 | + }  | 
                                                        |
| 155 | +  | 
                                                        |
| 156 | +  | 
                                                        |
| 157 | + /**  | 
                                                        |
| 158 | + * @param ResponseInterface $response  | 
                                                        |
| 159 | + */  | 
                                                        |
| 160 | + public function setResponse(ResponseInterface $response)  | 
                                                        |
| 161 | +	{ | 
                                                        |
| 162 | + $this->response = $response;  | 
                                                        |
| 163 | + }  | 
                                                        |
| 164 | +  | 
                                                        |
| 165 | +  | 
                                                        |
| 166 | +  | 
                                                        |
| 167 | + /**  | 
                                                        |
| 168 | + * @param LoaderInterface $loader  | 
                                                        |
| 169 | + */  | 
                                                        |
| 170 | + public function setLoader(LoaderInterface $loader)  | 
                                                        |
| 171 | +	{ | 
                                                        |
| 172 | + $this->loader = $loader;  | 
                                                        |
| 173 | + }  | 
                                                        |
| 174 | +  | 
                                                        |
| 175 | +  | 
                                                        |
| 176 | +  | 
                                                        |
| 177 | + /**  | 
                                                        |
| 178 | + * @param string $class  | 
                                                        |
| 179 | + * @param array $dependencies  | 
                                                        |
| 180 | + * @param int $overwrite  | 
                                                        |
| 181 | + * @return bool  | 
                                                        |
| 182 | + */  | 
                                                        |
| 183 | + public static function register_dependencies(  | 
                                                        |
| 184 | + $class,  | 
                                                        |
| 185 | + array $dependencies,  | 
                                                        |
| 186 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES  | 
                                                        |
| 187 | +	) { | 
                                                        |
| 188 | + return self::$_instance->registerDependencies($class, $dependencies, $overwrite);  | 
                                                        |
| 189 | + }  | 
                                                        |
| 190 | +  | 
                                                        |
| 191 | +  | 
                                                        |
| 192 | +  | 
                                                        |
| 193 | + /**  | 
                                                        |
| 194 | + * Assigns an array of class names and corresponding load sources (new or cached)  | 
                                                        |
| 195 | + * to the class specified by the first parameter.  | 
                                                        |
| 196 | + * IMPORTANT !!!  | 
                                                        |
| 197 | + * The order of elements in the incoming $dependencies array MUST match  | 
                                                        |
| 198 | + * the order of the constructor parameters for the class in question.  | 
                                                        |
| 199 | + * This is especially important when overriding any existing dependencies that are registered.  | 
                                                        |
| 200 | + * the third parameter controls whether any duplicate dependencies are overwritten or not.  | 
                                                        |
| 201 | + *  | 
                                                        |
| 202 | + * @param string $class  | 
                                                        |
| 203 | + * @param array $dependencies  | 
                                                        |
| 204 | + * @param int $overwrite  | 
                                                        |
| 205 | + * @return bool  | 
                                                        |
| 206 | + */  | 
                                                        |
| 207 | + public function registerDependencies(  | 
                                                        |
| 208 | + $class,  | 
                                                        |
| 209 | + array $dependencies,  | 
                                                        |
| 210 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES  | 
                                                        |
| 211 | +	) { | 
                                                        |
| 212 | + $class = trim($class, '\\');  | 
                                                        |
| 213 | + $registered = false;  | 
                                                        |
| 214 | +		if (empty(self::$_instance->_dependency_map[ $class ])) { | 
                                                        |
| 215 | + self::$_instance->_dependency_map[ $class ] = array();  | 
                                                        |
| 216 | + }  | 
                                                        |
| 217 | + // we need to make sure that any aliases used when registering a dependency  | 
                                                        |
| 218 | + // get resolved to the correct class name  | 
                                                        |
| 219 | +		foreach ($dependencies as $dependency => $load_source) { | 
                                                        |
| 220 | + $alias = self::$_instance->get_alias($dependency);  | 
                                                        |
| 221 | + if (  | 
                                                        |
| 222 | + $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES  | 
                                                        |
| 223 | + || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ])  | 
                                                        |
| 224 | +			) { | 
                                                        |
| 225 | + unset($dependencies[$dependency]);  | 
                                                        |
| 226 | + $dependencies[$alias] = $load_source;  | 
                                                        |
| 227 | + $registered = true;  | 
                                                        |
| 228 | + }  | 
                                                        |
| 229 | + }  | 
                                                        |
| 230 | + // now add our two lists of dependencies together.  | 
                                                        |
| 231 | + // using Union (+=) favours the arrays in precedence from left to right,  | 
                                                        |
| 232 | + // so $dependencies is NOT overwritten because it is listed first  | 
                                                        |
| 233 | + // ie: with A = B + C, entries in B take precedence over duplicate entries in C  | 
                                                        |
| 234 | + // Union is way faster than array_merge() but should be used with caution...  | 
                                                        |
| 235 | + // especially with numerically indexed arrays  | 
                                                        |
| 236 | + $dependencies += self::$_instance->_dependency_map[ $class ];  | 
                                                        |
| 237 | + // now we need to ensure that the resulting dependencies  | 
                                                        |
| 238 | + // array only has the entries that are required for the class  | 
                                                        |
| 239 | + // so first count how many dependencies were originally registered for the class  | 
                                                        |
| 240 | + $dependency_count = count(self::$_instance->_dependency_map[ $class ]);  | 
                                                        |
| 241 | + // if that count is non-zero (meaning dependencies were already registered)  | 
                                                        |
| 242 | + self::$_instance->_dependency_map[ $class ] = $dependency_count  | 
                                                        |
| 243 | + // then truncate the final array to match that count  | 
                                                        |
| 244 | + ? array_slice($dependencies, 0, $dependency_count)  | 
                                                        |
| 245 | + // otherwise just take the incoming array because nothing previously existed  | 
                                                        |
| 246 | + : $dependencies;  | 
                                                        |
| 247 | + return $registered;  | 
                                                        |
| 248 | + }  | 
                                                        |
| 249 | +  | 
                                                        |
| 250 | +  | 
                                                        |
| 251 | +  | 
                                                        |
| 252 | + /**  | 
                                                        |
| 253 | + * @param string $class_name  | 
                                                        |
| 254 | + * @param string $loader  | 
                                                        |
| 255 | + * @return bool  | 
                                                        |
| 256 | + * @throws DomainException  | 
                                                        |
| 257 | + */  | 
                                                        |
| 258 | + public static function register_class_loader($class_name, $loader = 'load_core')  | 
                                                        |
| 259 | +	{ | 
                                                        |
| 260 | +		if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { | 
                                                        |
| 261 | + throw new DomainException(  | 
                                                        |
| 262 | +				esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') | 
                                                        |
| 263 | + );  | 
                                                        |
| 264 | + }  | 
                                                        |
| 265 | + // check that loader is callable or method starts with "load_" and exists in EE_Registry  | 
                                                        |
| 266 | + if (  | 
                                                        |
| 267 | + ! is_callable($loader)  | 
                                                        |
| 268 | + && (  | 
                                                        |
| 269 | + strpos($loader, 'load_') !== 0  | 
                                                        |
| 270 | +				|| ! method_exists('EE_Registry', $loader) | 
                                                        |
| 271 | + )  | 
                                                        |
| 272 | +		) { | 
                                                        |
| 273 | + throw new DomainException(  | 
                                                        |
| 274 | + sprintf(  | 
                                                        |
| 275 | + esc_html__(  | 
                                                        |
| 276 | + '"%1$s" is not a valid loader method on EE_Registry.',  | 
                                                        |
| 277 | + 'event_espresso'  | 
                                                        |
| 278 | + ),  | 
                                                        |
| 279 | + $loader  | 
                                                        |
| 280 | + )  | 
                                                        |
| 281 | + );  | 
                                                        |
| 282 | + }  | 
                                                        |
| 283 | + $class_name = self::$_instance->get_alias($class_name);  | 
                                                        |
| 284 | +		if (! isset(self::$_instance->_class_loaders[$class_name])) { | 
                                                        |
| 285 | + self::$_instance->_class_loaders[$class_name] = $loader;  | 
                                                        |
| 286 | + return true;  | 
                                                        |
| 287 | + }  | 
                                                        |
| 288 | + return false;  | 
                                                        |
| 289 | + }  | 
                                                        |
| 290 | +  | 
                                                        |
| 291 | +  | 
                                                        |
| 292 | +  | 
                                                        |
| 293 | + /**  | 
                                                        |
| 294 | + * @return array  | 
                                                        |
| 295 | + */  | 
                                                        |
| 296 | + public function dependency_map()  | 
                                                        |
| 297 | +	{ | 
                                                        |
| 298 | + return $this->_dependency_map;  | 
                                                        |
| 299 | + }  | 
                                                        |
| 300 | +  | 
                                                        |
| 301 | +  | 
                                                        |
| 302 | +  | 
                                                        |
| 303 | + /**  | 
                                                        |
| 304 | + * returns TRUE if dependency map contains a listing for the provided class name  | 
                                                        |
| 305 | + *  | 
                                                        |
| 306 | + * @param string $class_name  | 
                                                        |
| 307 | + * @return boolean  | 
                                                        |
| 308 | + */  | 
                                                        |
| 309 | + public function has($class_name = '')  | 
                                                        |
| 310 | +	{ | 
                                                        |
| 311 | + // all legacy models have the same dependencies  | 
                                                        |
| 312 | +		if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 313 | + $class_name = 'LEGACY_MODELS';  | 
                                                        |
| 314 | + }  | 
                                                        |
| 315 | + return isset($this->_dependency_map[$class_name]) ? true : false;  | 
                                                        |
| 316 | + }  | 
                                                        |
| 317 | +  | 
                                                        |
| 318 | +  | 
                                                        |
| 319 | +  | 
                                                        |
| 320 | + /**  | 
                                                        |
| 321 | + * returns TRUE if dependency map contains a listing for the provided class name AND dependency  | 
                                                        |
| 322 | + *  | 
                                                        |
| 323 | + * @param string $class_name  | 
                                                        |
| 324 | + * @param string $dependency  | 
                                                        |
| 325 | + * @return bool  | 
                                                        |
| 326 | + */  | 
                                                        |
| 327 | + public function has_dependency_for_class($class_name = '', $dependency = '')  | 
                                                        |
| 328 | +	{ | 
                                                        |
| 329 | + // all legacy models have the same dependencies  | 
                                                        |
| 330 | +		if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 331 | + $class_name = 'LEGACY_MODELS';  | 
                                                        |
| 332 | + }  | 
                                                        |
| 333 | + $dependency = $this->get_alias($dependency);  | 
                                                        |
| 334 | + return isset($this->_dependency_map[$class_name][$dependency])  | 
                                                        |
| 335 | + ? true  | 
                                                        |
| 336 | + : false;  | 
                                                        |
| 337 | + }  | 
                                                        |
| 338 | +  | 
                                                        |
| 339 | +  | 
                                                        |
| 340 | +  | 
                                                        |
| 341 | + /**  | 
                                                        |
| 342 | + * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned  | 
                                                        |
| 343 | + *  | 
                                                        |
| 344 | + * @param string $class_name  | 
                                                        |
| 345 | + * @param string $dependency  | 
                                                        |
| 346 | + * @return int  | 
                                                        |
| 347 | + */  | 
                                                        |
| 348 | + public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')  | 
                                                        |
| 349 | +	{ | 
                                                        |
| 350 | + // all legacy models have the same dependencies  | 
                                                        |
| 351 | +		if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 352 | + $class_name = 'LEGACY_MODELS';  | 
                                                        |
| 353 | + }  | 
                                                        |
| 354 | + $dependency = $this->get_alias($dependency);  | 
                                                        |
| 355 | + return $this->has_dependency_for_class($class_name, $dependency)  | 
                                                        |
| 356 | + ? $this->_dependency_map[$class_name][$dependency]  | 
                                                        |
| 357 | + : EE_Dependency_Map::not_registered;  | 
                                                        |
| 358 | + }  | 
                                                        |
| 359 | +  | 
                                                        |
| 360 | +  | 
                                                        |
| 361 | +  | 
                                                        |
| 362 | + /**  | 
                                                        |
| 363 | + * @param string $class_name  | 
                                                        |
| 364 | + * @return string | Closure  | 
                                                        |
| 365 | + */  | 
                                                        |
| 366 | + public function class_loader($class_name)  | 
                                                        |
| 367 | +	{ | 
                                                        |
| 368 | + // all legacy models use load_model()  | 
                                                        |
| 369 | +		if(strpos($class_name, 'EEM_') === 0){ | 
                                                        |
| 370 | + return 'load_model';  | 
                                                        |
| 371 | + }  | 
                                                        |
| 372 | + $class_name = $this->get_alias($class_name);  | 
                                                        |
| 373 | + return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : '';  | 
                                                        |
| 374 | + }  | 
                                                        |
| 375 | +  | 
                                                        |
| 376 | +  | 
                                                        |
| 377 | +  | 
                                                        |
| 378 | + /**  | 
                                                        |
| 379 | + * @return array  | 
                                                        |
| 380 | + */  | 
                                                        |
| 381 | + public function class_loaders()  | 
                                                        |
| 382 | +	{ | 
                                                        |
| 383 | + return $this->_class_loaders;  | 
                                                        |
| 384 | + }  | 
                                                        |
| 385 | +  | 
                                                        |
| 386 | +  | 
                                                        |
| 387 | +  | 
                                                        |
| 388 | + /**  | 
                                                        |
| 389 | + * adds an alias for a classname  | 
                                                        |
| 390 | + *  | 
                                                        |
| 391 | + * @param string $class_name the class name that should be used (concrete class to replace interface)  | 
                                                        |
| 392 | + * @param string $alias the class name that would be type hinted for (abstract parent or interface)  | 
                                                        |
| 393 | + * @param string $for_class the class that has the dependency (is type hinting for the interface)  | 
                                                        |
| 394 | + */  | 
                                                        |
| 395 | + public function add_alias($class_name, $alias, $for_class = '')  | 
                                                        |
| 396 | +	{ | 
                                                        |
| 397 | +		if ($for_class !== '') { | 
                                                        |
| 398 | +			if (! isset($this->_aliases[$for_class])) { | 
                                                        |
| 399 | + $this->_aliases[$for_class] = array();  | 
                                                        |
| 400 | + }  | 
                                                        |
| 401 | + $this->_aliases[$for_class][$class_name] = $alias;  | 
                                                        |
| 402 | + }  | 
                                                        |
| 403 | + $this->_aliases[$class_name] = $alias;  | 
                                                        |
| 404 | + }  | 
                                                        |
| 405 | +  | 
                                                        |
| 406 | +  | 
                                                        |
| 407 | +  | 
                                                        |
| 408 | + /**  | 
                                                        |
| 409 | + * returns TRUE if the provided class name has an alias  | 
                                                        |
| 410 | + *  | 
                                                        |
| 411 | + * @param string $class_name  | 
                                                        |
| 412 | + * @param string $for_class  | 
                                                        |
| 413 | + * @return bool  | 
                                                        |
| 414 | + */  | 
                                                        |
| 415 | + public function has_alias($class_name = '', $for_class = '')  | 
                                                        |
| 416 | +	{ | 
                                                        |
| 417 | + return isset($this->_aliases[$for_class][$class_name])  | 
                                                        |
| 418 | + || (  | 
                                                        |
| 419 | + isset($this->_aliases[$class_name])  | 
                                                        |
| 420 | + && ! is_array($this->_aliases[$class_name])  | 
                                                        |
| 421 | + );  | 
                                                        |
| 422 | + }  | 
                                                        |
| 423 | +  | 
                                                        |
| 424 | +  | 
                                                        |
| 425 | +  | 
                                                        |
| 426 | + /**  | 
                                                        |
| 427 | + * returns alias for class name if one exists, otherwise returns the original classname  | 
                                                        |
| 428 | + * functions recursively, so that multiple aliases can be used to drill down to a classname  | 
                                                        |
| 429 | + * for example:  | 
                                                        |
| 430 | + * if the following two entries were added to the _aliases array:  | 
                                                        |
| 431 | + * array(  | 
                                                        |
| 432 | + * 'interface_alias' => 'some\namespace\interface'  | 
                                                        |
| 433 | + * 'some\namespace\interface' => 'some\namespace\classname'  | 
                                                        |
| 434 | + * )  | 
                                                        |
| 435 | + * then one could use EE_Registry::instance()->create( 'interface_alias' )  | 
                                                        |
| 436 | + * to load an instance of 'some\namespace\classname'  | 
                                                        |
| 437 | + *  | 
                                                        |
| 438 | + * @param string $class_name  | 
                                                        |
| 439 | + * @param string $for_class  | 
                                                        |
| 440 | + * @return string  | 
                                                        |
| 441 | + */  | 
                                                        |
| 442 | + public function get_alias($class_name = '', $for_class = '')  | 
                                                        |
| 443 | +	{ | 
                                                        |
| 444 | +		if (! $this->has_alias($class_name, $for_class)) { | 
                                                        |
| 445 | + return $class_name;  | 
                                                        |
| 446 | + }  | 
                                                        |
| 447 | +		if ($for_class !== '' && isset($this->_aliases[ $for_class ][ $class_name ])) { | 
                                                        |
| 448 | + return $this->get_alias($this->_aliases[$for_class][$class_name], $for_class);  | 
                                                        |
| 449 | + }  | 
                                                        |
| 450 | + return $this->get_alias($this->_aliases[$class_name]);  | 
                                                        |
| 451 | + }  | 
                                                        |
| 452 | +  | 
                                                        |
| 453 | +  | 
                                                        |
| 454 | +  | 
                                                        |
| 455 | + /**  | 
                                                        |
| 456 | + * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,  | 
                                                        |
| 457 | + * if one exists, or whether a new object should be generated every time the requested class is loaded.  | 
                                                        |
| 458 | + * This is done by using the following class constants:  | 
                                                        |
| 459 | + * EE_Dependency_Map::load_from_cache - loads previously instantiated object  | 
                                                        |
| 460 | + * EE_Dependency_Map::load_new_object - generates a new object every time  | 
                                                        |
| 461 | + */  | 
                                                        |
| 462 | + protected function _register_core_dependencies()  | 
                                                        |
| 463 | +	{ | 
                                                        |
| 464 | + $this->_dependency_map = array(  | 
                                                        |
| 465 | + 'EE_Request_Handler' => array(  | 
                                                        |
| 466 | + 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 467 | + ),  | 
                                                        |
| 468 | + 'EE_System' => array(  | 
                                                        |
| 469 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 470 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 471 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 472 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 473 | + ),  | 
                                                        |
| 474 | + 'EE_Session' => array(  | 
                                                        |
| 475 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 476 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 477 | + 'EE_Encryption' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 478 | + ),  | 
                                                        |
| 479 | + 'EE_Cart' => array(  | 
                                                        |
| 480 | + 'EE_Session' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 481 | + ),  | 
                                                        |
| 482 | + 'EE_Front_Controller' => array(  | 
                                                        |
| 483 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 484 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 485 | + 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 486 | + ),  | 
                                                        |
| 487 | + 'EE_Messenger_Collection_Loader' => array(  | 
                                                        |
| 488 | + 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 489 | + ),  | 
                                                        |
| 490 | + 'EE_Message_Type_Collection_Loader' => array(  | 
                                                        |
| 491 | + 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 492 | + ),  | 
                                                        |
| 493 | + 'EE_Message_Resource_Manager' => array(  | 
                                                        |
| 494 | + 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 495 | + 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 496 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 497 | + ),  | 
                                                        |
| 498 | + 'EE_Message_Factory' => array(  | 
                                                        |
| 499 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 500 | + ),  | 
                                                        |
| 501 | + 'EE_messages' => array(  | 
                                                        |
| 502 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 503 | + ),  | 
                                                        |
| 504 | + 'EE_Messages_Generator' => array(  | 
                                                        |
| 505 | + 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 506 | + 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 507 | + 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 508 | + 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 509 | + ),  | 
                                                        |
| 510 | + 'EE_Messages_Processor' => array(  | 
                                                        |
| 511 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 512 | + ),  | 
                                                        |
| 513 | + 'EE_Messages_Queue' => array(  | 
                                                        |
| 514 | + 'EE_Message_Repository' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 515 | + ),  | 
                                                        |
| 516 | + 'EE_Messages_Template_Defaults' => array(  | 
                                                        |
| 517 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 518 | + 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 519 | + ),  | 
                                                        |
| 520 | + 'EE_Message_To_Generate_From_Request' => array(  | 
                                                        |
| 521 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 522 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 523 | + ),  | 
                                                        |
| 524 | + 'EventEspresso\core\services\commands\CommandBus' => array(  | 
                                                        |
| 525 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 526 | + ),  | 
                                                        |
| 527 | + 'EventEspresso\services\commands\CommandHandler' => array(  | 
                                                        |
| 528 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 529 | + 'CommandBusInterface' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 530 | + ),  | 
                                                        |
| 531 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => array(  | 
                                                        |
| 532 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 533 | + ),  | 
                                                        |
| 534 | + 'EventEspresso\core\services\commands\CompositeCommandHandler' => array(  | 
                                                        |
| 535 | + 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 536 | + 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 537 | + ),  | 
                                                        |
| 538 | + 'EventEspresso\core\services\commands\CommandFactory' => array(  | 
                                                        |
| 539 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 540 | + ),  | 
                                                        |
| 541 | + 'EventEspresso\core\services\commands\middleware\CapChecker' => array(  | 
                                                        |
| 542 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 543 | + ),  | 
                                                        |
| 544 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => array(  | 
                                                        |
| 545 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 546 | + ),  | 
                                                        |
| 547 | + 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => array(  | 
                                                        |
| 548 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 549 | + ),  | 
                                                        |
| 550 | + 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => array(  | 
                                                        |
| 551 | + 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 552 | + ),  | 
                                                        |
| 553 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => array(  | 
                                                        |
| 554 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 555 | + ),  | 
                                                        |
| 556 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => array(  | 
                                                        |
| 557 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 558 | + ),  | 
                                                        |
| 559 | + 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => array(  | 
                                                        |
| 560 | + 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 561 | + ),  | 
                                                        |
| 562 | + 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array(  | 
                                                        |
| 563 | + 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 564 | + ),  | 
                                                        |
| 565 | + 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => array(  | 
                                                        |
| 566 | + 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 567 | + ),  | 
                                                        |
| 568 | + 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => array(  | 
                                                        |
| 569 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 570 | + ),  | 
                                                        |
| 571 | + 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => array(  | 
                                                        |
| 572 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 573 | + ),  | 
                                                        |
| 574 | + 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => array(  | 
                                                        |
| 575 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 576 | + ),  | 
                                                        |
| 577 | + 'EventEspresso\core\services\database\TableManager' => array(  | 
                                                        |
| 578 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 579 | + ),  | 
                                                        |
| 580 | + 'EE_Data_Migration_Class_Base' => 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_1_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_2_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_3_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_4_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_5_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_6_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 | + 'EE_DMS_Core_4_7_0' => array(  | 
                                                        |
| 609 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 610 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 611 | + ),  | 
                                                        |
| 612 | + 'EE_DMS_Core_4_8_0' => array(  | 
                                                        |
| 613 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 614 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 615 | + ),  | 
                                                        |
| 616 | + 'EE_DMS_Core_4_9_0' => array(  | 
                                                        |
| 617 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 618 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 619 | + ),  | 
                                                        |
| 620 | + 'EventEspresso\core\services\assets\Registry' => array(  | 
                                                        |
| 621 | + 'EE_Template_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 622 | + 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 623 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 624 | + ),  | 
                                                        |
| 625 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => array(  | 
                                                        |
| 626 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 627 | + ),  | 
                                                        |
| 628 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => array(  | 
                                                        |
| 629 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 630 | + ),  | 
                                                        |
| 631 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => array(  | 
                                                        |
| 632 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 633 | + ),  | 
                                                        |
| 634 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => array(  | 
                                                        |
| 635 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 636 | + ),  | 
                                                        |
| 637 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => array(  | 
                                                        |
| 638 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 639 | + ),  | 
                                                        |
| 640 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => array(  | 
                                                        |
| 641 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 642 | + ),  | 
                                                        |
| 643 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => array(  | 
                                                        |
| 644 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 645 | + ),  | 
                                                        |
| 646 | + 'EventEspresso\core\services\cache\BasicCacheManager' => array(  | 
                                                        |
| 647 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 648 | + ),  | 
                                                        |
| 649 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => array(  | 
                                                        |
| 650 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 651 | + ),  | 
                                                        |
| 652 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => array(  | 
                                                        |
| 653 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 654 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 655 | + ),  | 
                                                        |
| 656 | + 'EventEspresso\core\domain\values\EmailAddress' => array(  | 
                                                        |
| 657 | + null,  | 
                                                        |
| 658 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 659 | + ),  | 
                                                        |
| 660 | + 'EventEspresso\core\services\orm\ModelFieldFactory' => array(  | 
                                                        |
| 661 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 662 | + ),  | 
                                                        |
| 663 | + 'LEGACY_MODELS' => array(  | 
                                                        |
| 664 | + null,  | 
                                                        |
| 665 | + 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 666 | + ),  | 
                                                        |
| 667 | + 'EventEspresso\core\services\activation\ActivationsAndUpgradesManager' => array(  | 
                                                        |
| 668 | + 'EventEspresso\core\services\activation\ActivationHandler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 669 | + 'EventEspresso\core\services\activation\ActivationTypeDetector' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 670 | + ),  | 
                                                        |
| 671 | + 'EventEspresso\core\services\activation\ActivationHandler' => array(  | 
                                                        |
| 672 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 673 | + ),  | 
                                                        |
| 674 | + 'EventEspresso\core\services\activation\InitializeCore' => array(  | 
                                                        |
| 675 | + null,  | 
                                                        |
| 676 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 677 | + 'EE_Data_Migration_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 678 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 679 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 680 | + ),  | 
                                                        |
| 681 | + 'EventEspresso\core\services\activation\InitializeAddon' => array(  | 
                                                        |
| 682 | + null,  | 
                                                        |
| 683 | + 'EE_Data_Migration_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 684 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 685 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 686 | + ),  | 
                                                        |
| 687 | + 'EE_Module_Request_Router' => array(  | 
                                                        |
| 688 | + 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 689 | + ),  | 
                                                        |
| 690 | + 'EE_Registration_Processor' => array(  | 
                                                        |
| 691 | + 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 692 | + ),  | 
                                                        |
| 693 | + 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => array(  | 
                                                        |
| 694 | + null,  | 
                                                        |
| 695 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 696 | + 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 697 | + ),  | 
                                                        |
| 698 | + );  | 
                                                        |
| 699 | + }  | 
                                                        |
| 700 | +  | 
                                                        |
| 701 | +  | 
                                                        |
| 702 | +  | 
                                                        |
| 703 | + /**  | 
                                                        |
| 704 | + * Registers how core classes are loaded.  | 
                                                        |
| 705 | + * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:  | 
                                                        |
| 706 | + * 'EE_Request_Handler' => 'load_core'  | 
                                                        |
| 707 | + * 'EE_Messages_Queue' => 'load_lib'  | 
                                                        |
| 708 | + * 'EEH_Debug_Tools' => 'load_helper'  | 
                                                        |
| 709 | + * or, if greater control is required, by providing a custom closure. For example:  | 
                                                        |
| 710 | +	 *        'Some_Class' => function () { | 
                                                        |
| 711 | + * return new Some_Class();  | 
                                                        |
| 712 | + * },  | 
                                                        |
| 713 | + * This is required for instantiating dependencies  | 
                                                        |
| 714 | + * where an interface has been type hinted in a class constructor. For example:  | 
                                                        |
| 715 | +	 *        'Required_Interface' => function () { | 
                                                        |
| 716 | + * return new A_Class_That_Implements_Required_Interface();  | 
                                                        |
| 717 | + * },  | 
                                                        |
| 718 | + *  | 
                                                        |
| 719 | + * @throws InvalidInterfaceException  | 
                                                        |
| 720 | + * @throws InvalidDataTypeException  | 
                                                        |
| 721 | + * @throws InvalidArgumentException  | 
                                                        |
| 722 | + */  | 
                                                        |
| 723 | + protected function _register_core_class_loaders()  | 
                                                        |
| 724 | +	{ | 
                                                        |
| 725 | + //for PHP5.3 compat, we need to register any properties called here in a variable because `$this` cannot  | 
                                                        |
| 726 | + //be used in a closure.  | 
                                                        |
| 727 | + $request = &$this->request;  | 
                                                        |
| 728 | + $response = &$this->response;  | 
                                                        |
| 729 | + $legacy_request = &$this->legacy_request;  | 
                                                        |
| 730 | + // $loader = &$this->loader;  | 
                                                        |
| 731 | + $this->_class_loaders = array(  | 
                                                        |
| 732 | + //load_core  | 
                                                        |
| 733 | + 'EE_Capabilities' => 'load_core',  | 
                                                        |
| 734 | + 'EE_Encryption' => 'load_core',  | 
                                                        |
| 735 | + 'EE_Front_Controller' => 'load_core',  | 
                                                        |
| 736 | + 'EE_Module_Request_Router' => 'load_core',  | 
                                                        |
| 737 | + 'EE_Registry' => 'load_core',  | 
                                                        |
| 738 | +			'EE_Request'               => function () use (&$legacy_request) { | 
                                                        |
| 739 | + return $legacy_request;  | 
                                                        |
| 740 | + },  | 
                                                        |
| 741 | +			'EventEspresso\core\services\request\Request' => function () use (&$request) { | 
                                                        |
| 742 | + return $request;  | 
                                                        |
| 743 | + },  | 
                                                        |
| 744 | +			'EventEspresso\core\services\request\Response' => function () use (&$response) { | 
                                                        |
| 745 | + return $response;  | 
                                                        |
| 746 | + },  | 
                                                        |
| 747 | + 'EE_Request_Handler' => 'load_core',  | 
                                                        |
| 748 | + 'EE_Session' => 'load_core',  | 
                                                        |
| 749 | + 'EE_Cron_Tasks' => 'load_core',  | 
                                                        |
| 750 | + 'EE_System' => 'load_core',  | 
                                                        |
| 751 | + 'EE_Maintenance_Mode' => 'load_core',  | 
                                                        |
| 752 | + 'EE_Register_CPTs' => 'load_core',  | 
                                                        |
| 753 | + 'EE_Admin' => 'load_core',  | 
                                                        |
| 754 | + 'EE_Data_Migration_Manager' => 'load_core',  | 
                                                        |
| 755 | + //load_lib  | 
                                                        |
| 756 | + 'EE_Message_Resource_Manager' => 'load_lib',  | 
                                                        |
| 757 | + 'EE_Message_Type_Collection' => 'load_lib',  | 
                                                        |
| 758 | + 'EE_Message_Type_Collection_Loader' => 'load_lib',  | 
                                                        |
| 759 | + 'EE_Messenger_Collection' => 'load_lib',  | 
                                                        |
| 760 | + 'EE_Messenger_Collection_Loader' => 'load_lib',  | 
                                                        |
| 761 | + 'EE_Messages_Processor' => 'load_lib',  | 
                                                        |
| 762 | + 'EE_Message_Repository' => 'load_lib',  | 
                                                        |
| 763 | + 'EE_Messages_Queue' => 'load_lib',  | 
                                                        |
| 764 | + 'EE_Messages_Data_Handler_Collection' => 'load_lib',  | 
                                                        |
| 765 | + 'EE_Message_Template_Group_Collection' => 'load_lib',  | 
                                                        |
| 766 | + 'EE_Payment_Method_Manager' => 'load_lib',  | 
                                                        |
| 767 | +			'EE_Messages_Generator'                => function () { | 
                                                        |
| 768 | + return EE_Registry::instance()->load_lib(  | 
                                                        |
| 769 | + 'Messages_Generator',  | 
                                                        |
| 770 | + array(),  | 
                                                        |
| 771 | + false,  | 
                                                        |
| 772 | + false  | 
                                                        |
| 773 | + );  | 
                                                        |
| 774 | + },  | 
                                                        |
| 775 | +			'EE_Messages_Template_Defaults'        => function ($arguments = array()) { | 
                                                        |
| 776 | + return EE_Registry::instance()->load_lib(  | 
                                                        |
| 777 | + 'Messages_Template_Defaults',  | 
                                                        |
| 778 | + $arguments,  | 
                                                        |
| 779 | + false,  | 
                                                        |
| 780 | + false  | 
                                                        |
| 781 | + );  | 
                                                        |
| 782 | + },  | 
                                                        |
| 783 | + //load_model  | 
                                                        |
| 784 | + // 'EEM_Attendee' => 'load_model',  | 
                                                        |
| 785 | + // 'EEM_Message_Template_Group' => 'load_model',  | 
                                                        |
| 786 | + // 'EEM_Message_Template' => 'load_model',  | 
                                                        |
| 787 | + //load_helper  | 
                                                        |
| 788 | +			'EEH_Parse_Shortcodes'                 => function () { | 
                                                        |
| 789 | +				if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { | 
                                                        |
| 790 | + return new EEH_Parse_Shortcodes();  | 
                                                        |
| 791 | + }  | 
                                                        |
| 792 | + return null;  | 
                                                        |
| 793 | + },  | 
                                                        |
| 794 | +			'EE_Template_Config'                   => function () { | 
                                                        |
| 795 | + return EE_Config::instance()->template_settings;  | 
                                                        |
| 796 | + },  | 
                                                        |
| 797 | +			'EE_Currency_Config'                   => function () { | 
                                                        |
| 798 | + return EE_Config::instance()->currency;  | 
                                                        |
| 799 | + },  | 
                                                        |
| 800 | +			'EE_Registration_Config'                   => function () { | 
                                                        |
| 801 | + return EE_Config::instance()->registration;  | 
                                                        |
| 802 | + },  | 
                                                        |
| 803 | +			'EventEspresso\core\services\loaders\Loader' => function () { | 
                                                        |
| 804 | + return LoaderFactory::getLoader();  | 
                                                        |
| 805 | + },  | 
                                                        |
| 806 | + );  | 
                                                        |
| 807 | + }  | 
                                                        |
| 808 | +  | 
                                                        |
| 809 | +  | 
                                                        |
| 810 | +  | 
                                                        |
| 811 | + /**  | 
                                                        |
| 812 | + * can be used for supplying alternate names for classes,  | 
                                                        |
| 813 | + * or for connecting interface names to instantiable classes  | 
                                                        |
| 814 | + */  | 
                                                        |
| 815 | + protected function _register_core_aliases()  | 
                                                        |
| 816 | +	{ | 
                                                        |
| 817 | + $this->_aliases = array(  | 
                                                        |
| 818 | + 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface',  | 
                                                        |
| 819 | + 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus',  | 
                                                        |
| 820 | + 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',  | 
                                                        |
| 821 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager',  | 
                                                        |
| 822 | + 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker',  | 
                                                        |
| 823 | + 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook',  | 
                                                        |
| 824 | + 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',  | 
                                                        |
| 825 | + 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',  | 
                                                        |
| 826 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',  | 
                                                        |
| 827 | + 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',  | 
                                                        |
| 828 | + 'CreateRegCodeCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegCodeCommand',  | 
                                                        |
| 829 | + 'CreateRegUrlLinkCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegUrlLinkCommand',  | 
                                                        |
| 830 | + 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',  | 
                                                        |
| 831 | + 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',  | 
                                                        |
| 832 | + 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',  | 
                                                        |
| 833 | + 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',  | 
                                                        |
| 834 | + 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',  | 
                                                        |
| 835 | + 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',  | 
                                                        |
| 836 | + 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',  | 
                                                        |
| 837 | + 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',  | 
                                                        |
| 838 | + 'TableManager' => 'EventEspresso\core\services\database\TableManager',  | 
                                                        |
| 839 | + 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis',  | 
                                                        |
| 840 | + 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode',  | 
                                                        |
| 841 | + 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',  | 
                                                        |
| 842 | + 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode',  | 
                                                        |
| 843 | + 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage',  | 
                                                        |
| 844 | + 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface',  | 
                                                        |
| 845 | + 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader',  | 
                                                        |
| 846 | + 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface',  | 
                                                        |
| 847 | + 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory',  | 
                                                        |
| 848 | + 'EventEspresso\core\domain\services\session\SessionIdentifierInterface' => 'EE_Session',  | 
                                                        |
| 849 | + 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',  | 
                                                        |
| 850 | + 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',  | 
                                                        |
| 851 | + 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface',  | 
                                                        |
| 852 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',  | 
                                                        |
| 853 | + 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface',  | 
                                                        |
| 854 | + 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer',  | 
                                                        |
| 855 | + 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request',  | 
                                                        |
| 856 | + 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response',  | 
                                                        |
| 857 | + 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain',  | 
                                                        |
| 858 | + );  | 
                                                        |
| 859 | +		if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { | 
                                                        |
| 860 | + $this->_aliases['EventEspresso\core\services\notices\NoticeConverterInterface'] = 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices';  | 
                                                        |
| 861 | + }  | 
                                                        |
| 862 | + }  | 
                                                        |
| 863 | +  | 
                                                        |
| 864 | +  | 
                                                        |
| 865 | +  | 
                                                        |
| 866 | + /**  | 
                                                        |
| 867 | + * This is used to reset the internal map and class_loaders to their original default state at the beginning of the  | 
                                                        |
| 868 | + * request Primarily used by unit tests.  | 
                                                        |
| 869 | + *  | 
                                                        |
| 870 | + * @throws InvalidDataTypeException  | 
                                                        |
| 871 | + * @throws InvalidInterfaceException  | 
                                                        |
| 872 | + * @throws InvalidArgumentException  | 
                                                        |
| 873 | + */  | 
                                                        |
| 874 | + public function reset()  | 
                                                        |
| 875 | +	{ | 
                                                        |
| 876 | + $this->_register_core_class_loaders();  | 
                                                        |
| 877 | + $this->_register_core_dependencies();  | 
                                                        |
| 878 | + }  | 
                                                        |
| 879 | 879 | |
| 880 | 880 | |
| 881 | 881 | }  | 
                                                        
@@ -17,496 +17,496 @@  | 
                                                    ||
| 17 | 17 | */  | 
                                                        
| 18 | 18 | abstract class EE_Model_Relation_Base implements HasSchemaInterface  | 
                                                        
| 19 | 19 |  { | 
                                                        
| 20 | - /**  | 
                                                        |
| 21 | - * The model name of which this relation is a component (ie, the model that called new EE_Model_Relation_Base)  | 
                                                        |
| 22 | - *  | 
                                                        |
| 23 | - * @var string eg Event, Question_Group, Registration  | 
                                                        |
| 24 | - */  | 
                                                        |
| 25 | - private $_this_model_name;  | 
                                                        |
| 26 | - /**  | 
                                                        |
| 27 | - * The model name pointed to by this relation (ie, the model we want to establish a relationship to)  | 
                                                        |
| 28 | - *  | 
                                                        |
| 29 | - * @var string eg Event, Question_Group, Registration  | 
                                                        |
| 30 | - */  | 
                                                        |
| 31 | - private $_other_model_name;  | 
                                                        |
| 32 | -  | 
                                                        |
| 33 | - /**  | 
                                                        |
| 34 | - * this is typically used when calling the relation models to make sure they inherit any set timezone from the  | 
                                                        |
| 35 | - * initiating model.  | 
                                                        |
| 36 | - *  | 
                                                        |
| 37 | - * @var string  | 
                                                        |
| 38 | - */  | 
                                                        |
| 39 | - protected $_timezone;  | 
                                                        |
| 40 | -  | 
                                                        |
| 41 | - /**  | 
                                                        |
| 42 | - * If you try to delete "this_model", and there are related "other_models",  | 
                                                        |
| 43 | - * and this isn't null, then abandon the deletion and add this warning.  | 
                                                        |
| 44 | - * This effectively makes it impossible to delete "this_model" while there are  | 
                                                        |
| 45 | - * related "other_models" along this relation.  | 
                                                        |
| 46 | - *  | 
                                                        |
| 47 | - * @var string (internationalized)  | 
                                                        |
| 48 | - */  | 
                                                        |
| 49 | - protected $_blocking_delete_error_message;  | 
                                                        |
| 50 | -  | 
                                                        |
| 51 | - protected $_blocking_delete = false;  | 
                                                        |
| 52 | -  | 
                                                        |
| 53 | - /**  | 
                                                        |
| 54 | - * Object representing the relationship between two models. This knows how to join the models,  | 
                                                        |
| 55 | - * get related models across the relation, and add-and-remove the relationships.  | 
                                                        |
| 56 | - *  | 
                                                        |
| 57 | - * @param boolean $block_deletes if there are related models across this relation, block (prevent  | 
                                                        |
| 58 | - * and add an error) the deletion of this model  | 
                                                        |
| 59 | - * @param string $blocking_delete_error_message a customized error message on blocking deletes instead of the  | 
                                                        |
| 60 | - * default  | 
                                                        |
| 61 | - */  | 
                                                        |
| 62 | - public function __construct($block_deletes, $blocking_delete_error_message)  | 
                                                        |
| 63 | -    { | 
                                                        |
| 64 | - $this->_blocking_delete = $block_deletes;  | 
                                                        |
| 65 | - $this->_blocking_delete_error_message = $blocking_delete_error_message;  | 
                                                        |
| 66 | - }  | 
                                                        |
| 67 | -  | 
                                                        |
| 68 | -  | 
                                                        |
| 69 | - /**  | 
                                                        |
| 70 | - * @param $this_model_name  | 
                                                        |
| 71 | - * @param $other_model_name  | 
                                                        |
| 72 | - * @throws EE_Error  | 
                                                        |
| 73 | - */  | 
                                                        |
| 74 | - public function _construct_finalize_set_models($this_model_name, $other_model_name)  | 
                                                        |
| 75 | -    { | 
                                                        |
| 76 | - $this->_this_model_name = $this_model_name;  | 
                                                        |
| 77 | - $this->_other_model_name = $other_model_name;  | 
                                                        |
| 78 | -        if (is_string($this->_blocking_delete)) { | 
                                                        |
| 79 | -            throw new EE_Error(sprintf(__("When instantiating the relation of type %s from %s to %s, the \$block_deletes argument should be a boolean, not a string (%s)", | 
                                                        |
| 80 | - "event_espresso"),  | 
                                                        |
| 81 | - get_class($this), $this_model_name, $other_model_name, $this->_blocking_delete));  | 
                                                        |
| 82 | - }  | 
                                                        |
| 83 | - }  | 
                                                        |
| 84 | -  | 
                                                        |
| 85 | -  | 
                                                        |
| 86 | - /**  | 
                                                        |
| 87 | - * Gets the model where this relation is defined.  | 
                                                        |
| 88 | - *  | 
                                                        |
| 89 | - * @return EEM_Base  | 
                                                        |
| 90 | - */  | 
                                                        |
| 91 | - public function get_this_model()  | 
                                                        |
| 92 | -    { | 
                                                        |
| 93 | - return $this->_get_model($this->_this_model_name);  | 
                                                        |
| 94 | - }  | 
                                                        |
| 95 | -  | 
                                                        |
| 96 | -  | 
                                                        |
| 97 | - /**  | 
                                                        |
| 98 | - * Gets the model which this relation establishes the relation TO (ie,  | 
                                                        |
| 99 | - * this relation object was defined on get_this_model(), get_other_model() is the other one)  | 
                                                        |
| 100 | - *  | 
                                                        |
| 101 | - * @return EEM_Base  | 
                                                        |
| 102 | - */  | 
                                                        |
| 103 | - public function get_other_model()  | 
                                                        |
| 104 | -    { | 
                                                        |
| 105 | - return $this->_get_model($this->_other_model_name);  | 
                                                        |
| 106 | - }  | 
                                                        |
| 107 | -  | 
                                                        |
| 108 | -  | 
                                                        |
| 109 | - /**  | 
                                                        |
| 110 | - * Internally used by get_this_model() and get_other_model()  | 
                                                        |
| 111 | - *  | 
                                                        |
| 112 | - * @param string $model_name like Event, Question_Group, etc. omit the EEM_  | 
                                                        |
| 113 | - * @return EEM_Base  | 
                                                        |
| 114 | - * @throws EE_Error  | 
                                                        |
| 115 | - * @throws InvalidArgumentException  | 
                                                        |
| 116 | - * @throws ReflectionException  | 
                                                        |
| 117 | - * @throws RuntimeException  | 
                                                        |
| 118 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException  | 
                                                        |
| 119 | - * @throws \EventEspresso\core\exceptions\InvalidInterfaceException  | 
                                                        |
| 120 | - */  | 
                                                        |
| 121 | - protected function _get_model($model_name)  | 
                                                        |
| 122 | -    { | 
                                                        |
| 123 | -        if(empty($model_name)) { | 
                                                        |
| 124 | - throw new RuntimeException(  | 
                                                        |
| 125 | - sprintf(  | 
                                                        |
| 126 | -                    esc_html__('Invalid Model name provided: "%1$s".', 'event_espresso'), | 
                                                        |
| 127 | - $model_name  | 
                                                        |
| 128 | - )  | 
                                                        |
| 129 | - );  | 
                                                        |
| 130 | - }  | 
                                                        |
| 131 | - $modelInstance = EE_Registry::instance()->load_model($model_name);  | 
                                                        |
| 132 | - $modelInstance->set_timezone($this->_timezone);  | 
                                                        |
| 133 | - return $modelInstance;  | 
                                                        |
| 134 | - }  | 
                                                        |
| 135 | -  | 
                                                        |
| 136 | -  | 
                                                        |
| 137 | - /**  | 
                                                        |
| 138 | - * entirely possible that relations may be called from a model and we need to make sure those relations have their  | 
                                                        |
| 139 | - * timezone set correctly.  | 
                                                        |
| 140 | - *  | 
                                                        |
| 141 | - * @param string $timezone timezone to set.  | 
                                                        |
| 142 | - */  | 
                                                        |
| 143 | - public function set_timezone($timezone)  | 
                                                        |
| 144 | -    { | 
                                                        |
| 145 | -        if ($timezone !== null) { | 
                                                        |
| 146 | - $this->_timezone = $timezone;  | 
                                                        |
| 147 | - }  | 
                                                        |
| 148 | - }  | 
                                                        |
| 149 | -  | 
                                                        |
| 150 | -  | 
                                                        |
| 151 | - /**  | 
                                                        |
| 152 | - * @param $other_table  | 
                                                        |
| 153 | - * @param $other_table_alias  | 
                                                        |
| 154 | - * @param $other_table_column  | 
                                                        |
| 155 | - * @param $this_table_alias  | 
                                                        |
| 156 | - * @param $this_table_join_column  | 
                                                        |
| 157 | - * @param string $extra_join_sql  | 
                                                        |
| 158 | - * @return string  | 
                                                        |
| 159 | - */  | 
                                                        |
| 160 | - protected function _left_join(  | 
                                                        |
| 161 | - $other_table,  | 
                                                        |
| 162 | - $other_table_alias,  | 
                                                        |
| 163 | - $other_table_column,  | 
                                                        |
| 164 | - $this_table_alias,  | 
                                                        |
| 165 | - $this_table_join_column,  | 
                                                        |
| 166 | - $extra_join_sql = ''  | 
                                                        |
| 167 | -    ) { | 
                                                        |
| 168 | - return " LEFT JOIN " . $other_table . " AS " . $other_table_alias . " ON " . $other_table_alias . "." . $other_table_column . "=" . $this_table_alias . "." . $this_table_join_column . ($extra_join_sql ? " AND $extra_join_sql" : '');  | 
                                                        |
| 169 | - }  | 
                                                        |
| 170 | -  | 
                                                        |
| 171 | -  | 
                                                        |
| 172 | - /**  | 
                                                        |
| 173 | - * Gets all the model objects of type of other model related to $model_object,  | 
                                                        |
| 174 | - * according to this relation. This is the same code for EE_HABTM_Relation and EE_Has_Many_Relation.  | 
                                                        |
| 175 | - * For both of those child classes, $model_object must be saved so that it has an ID before querying,  | 
                                                        |
| 176 | - * otherwise an error will be thrown. Note: by default we disable default_where_conditions  | 
                                                        |
| 177 | - * EE_Belongs_To_Relation doesn't need to be saved before querying.  | 
                                                        |
| 178 | - *  | 
                                                        |
| 179 | - * @param EE_Base_Class|int $model_object_or_id or the primary key of this model  | 
                                                        |
| 180 | - * @param array $query_params like EEM_Base::get_all's $query_params  | 
                                                        |
| 181 | - * @param boolean $values_already_prepared_by_model_object @deprecated since 4.8.1  | 
                                                        |
| 182 | - * @return EE_Base_Class[]  | 
                                                        |
| 183 | - * @throws \EE_Error  | 
                                                        |
| 184 | - */  | 
                                                        |
| 185 | - public function get_all_related(  | 
                                                        |
| 186 | - $model_object_or_id,  | 
                                                        |
| 187 | - $query_params = array(),  | 
                                                        |
| 188 | - $values_already_prepared_by_model_object = false  | 
                                                        |
| 189 | -    ) { | 
                                                        |
| 190 | -        if ($values_already_prepared_by_model_object !== false) { | 
                                                        |
| 191 | -            EE_Error::doing_it_wrong('EE_Model_Relation_Base::get_all_related', | 
                                                        |
| 192 | -                __('The argument $values_already_prepared_by_model_object is no longer used.', 'event_espresso'), | 
                                                        |
| 193 | - '4.8.1');  | 
                                                        |
| 194 | - }  | 
                                                        |
| 195 | - $query_params = $this->_disable_default_where_conditions_on_query_param($query_params);  | 
                                                        |
| 196 | - $query_param_where_this_model_pk = $this->get_this_model()->get_this_model_name()  | 
                                                        |
| 197 | - . "."  | 
                                                        |
| 198 | - . $this->get_this_model()->get_primary_key_field()->get_name();  | 
                                                        |
| 199 | - $model_object_id = $this->_get_model_object_id($model_object_or_id);  | 
                                                        |
| 200 | - $query_params[0][$query_param_where_this_model_pk] = $model_object_id;  | 
                                                        |
| 201 | - return $this->get_other_model()->get_all($query_params);  | 
                                                        |
| 202 | - }  | 
                                                        |
| 203 | -  | 
                                                        |
| 204 | -  | 
                                                        |
| 205 | - /**  | 
                                                        |
| 206 | - * Alters the $query_params to disable default where conditions, unless otherwise specified  | 
                                                        |
| 207 | - *  | 
                                                        |
| 208 | - * @param string $query_params  | 
                                                        |
| 209 | - * @return array  | 
                                                        |
| 210 | - */  | 
                                                        |
| 211 | - protected function _disable_default_where_conditions_on_query_param($query_params)  | 
                                                        |
| 212 | -    { | 
                                                        |
| 213 | -        if (! isset($query_params['default_where_conditions'])) { | 
                                                        |
| 214 | - $query_params['default_where_conditions'] = 'none';  | 
                                                        |
| 215 | - }  | 
                                                        |
| 216 | - return $query_params;  | 
                                                        |
| 217 | - }  | 
                                                        |
| 218 | -  | 
                                                        |
| 219 | -  | 
                                                        |
| 220 | - /**  | 
                                                        |
| 221 | - * Deletes the related model objects which meet the query parameters. If no  | 
                                                        |
| 222 | - * parameters are specified, then all related model objects will be deleted.  | 
                                                        |
| 223 | - * Note: If the related model is extends EEM_Soft_Delete_Base, then the related  | 
                                                        |
| 224 | - * model objects will only be soft-deleted.  | 
                                                        |
| 225 | - *  | 
                                                        |
| 226 | - * @param EE_Base_Class|int|string $model_object_or_id  | 
                                                        |
| 227 | - * @param array $query_params  | 
                                                        |
| 228 | - * @return int of how many related models got deleted  | 
                                                        |
| 229 | - * @throws \EE_Error  | 
                                                        |
| 230 | - */  | 
                                                        |
| 231 | - public function delete_all_related($model_object_or_id, $query_params = array())  | 
                                                        |
| 232 | -    { | 
                                                        |
| 233 | - //for each thing we would delete,  | 
                                                        |
| 234 | - $related_model_objects = $this->get_all_related($model_object_or_id, $query_params);  | 
                                                        |
| 235 | - //determine if it's blocked by anything else before it can be deleted  | 
                                                        |
| 236 | - $deleted_count = 0;  | 
                                                        |
| 237 | -        foreach ($related_model_objects as $related_model_object) { | 
                                                        |
| 238 | - $delete_is_blocked = $this->get_other_model()->delete_is_blocked_by_related_models($related_model_object,  | 
                                                        |
| 239 | - $model_object_or_id);  | 
                                                        |
| 240 | - /* @var $model_object_or_id EE_Base_Class */  | 
                                                        |
| 241 | -            if (! $delete_is_blocked) { | 
                                                        |
| 242 | - $this->remove_relation_to($model_object_or_id, $related_model_object);  | 
                                                        |
| 243 | - $related_model_object->delete();  | 
                                                        |
| 244 | - $deleted_count++;  | 
                                                        |
| 245 | - }  | 
                                                        |
| 246 | - }  | 
                                                        |
| 247 | - return $deleted_count;  | 
                                                        |
| 248 | - }  | 
                                                        |
| 249 | -  | 
                                                        |
| 250 | -  | 
                                                        |
| 251 | - /**  | 
                                                        |
| 252 | - * Deletes the related model objects which meet the query parameters. If no  | 
                                                        |
| 253 | - * parameters are specified, then all related model objects will be deleted.  | 
                                                        |
| 254 | - * Note: If the related model is extends EEM_Soft_Delete_Base, then the related  | 
                                                        |
| 255 | - * model objects will only be soft-deleted.  | 
                                                        |
| 256 | - *  | 
                                                        |
| 257 | - * @param EE_Base_Class|int|string $model_object_or_id  | 
                                                        |
| 258 | - * @param array $query_params  | 
                                                        |
| 259 | - * @return int of how many related models got deleted  | 
                                                        |
| 260 | - * @throws \EE_Error  | 
                                                        |
| 261 | - */  | 
                                                        |
| 262 | - public function delete_related_permanently($model_object_or_id, $query_params = array())  | 
                                                        |
| 263 | -    { | 
                                                        |
| 264 | - //for each thing we would delete,  | 
                                                        |
| 265 | - $related_model_objects = $this->get_all_related($model_object_or_id, $query_params);  | 
                                                        |
| 266 | - //determine if it's blocked by anything else before it can be deleted  | 
                                                        |
| 267 | - $deleted_count = 0;  | 
                                                        |
| 268 | -        foreach ($related_model_objects as $related_model_object) { | 
                                                        |
| 269 | - $delete_is_blocked = $this->get_other_model()->delete_is_blocked_by_related_models($related_model_object,  | 
                                                        |
| 270 | - $model_object_or_id);  | 
                                                        |
| 271 | - /* @var $model_object_or_id EE_Base_Class */  | 
                                                        |
| 272 | -            if ($related_model_object instanceof EE_Soft_Delete_Base_Class) { | 
                                                        |
| 273 | - $this->remove_relation_to($model_object_or_id, $related_model_object);  | 
                                                        |
| 274 | - $deleted_count++;  | 
                                                        |
| 275 | -                if (! $delete_is_blocked) { | 
                                                        |
| 276 | - $related_model_object->delete_permanently();  | 
                                                        |
| 277 | -                } else { | 
                                                        |
| 278 | - //delete is blocked  | 
                                                        |
| 279 | - //brent and darren, in this case, wanted to just soft delete it then  | 
                                                        |
| 280 | - $related_model_object->delete();  | 
                                                        |
| 281 | - }  | 
                                                        |
| 282 | -            } else { | 
                                                        |
| 283 | - //its not a soft-deletable thing anyways. do the normal logic.  | 
                                                        |
| 284 | -                if (! $delete_is_blocked) { | 
                                                        |
| 285 | - $this->remove_relation_to($model_object_or_id, $related_model_object);  | 
                                                        |
| 286 | - $related_model_object->delete();  | 
                                                        |
| 287 | - $deleted_count++;  | 
                                                        |
| 288 | - }  | 
                                                        |
| 289 | - }  | 
                                                        |
| 290 | - }  | 
                                                        |
| 291 | - return $deleted_count;  | 
                                                        |
| 292 | - }  | 
                                                        |
| 293 | -  | 
                                                        |
| 294 | -  | 
                                                        |
| 295 | - /**  | 
                                                        |
| 296 | - * this just returns a model_object_id for incoming item that could be an object or id.  | 
                                                        |
| 297 | - *  | 
                                                        |
| 298 | - * @param EE_Base_Class|int $model_object_or_id model object or the primary key of this model  | 
                                                        |
| 299 | - * @throws EE_Error  | 
                                                        |
| 300 | - * @return int  | 
                                                        |
| 301 | - */  | 
                                                        |
| 302 | - protected function _get_model_object_id($model_object_or_id)  | 
                                                        |
| 303 | -    { | 
                                                        |
| 304 | - $model_object_id = $model_object_or_id;  | 
                                                        |
| 305 | -        if ($model_object_or_id instanceof EE_Base_Class) { | 
                                                        |
| 306 | - $model_object_id = $model_object_or_id->ID();  | 
                                                        |
| 307 | - }  | 
                                                        |
| 308 | -        if (! $model_object_id) { | 
                                                        |
| 309 | -            throw new EE_Error(sprintf(__("Sorry, we cant get the related %s model objects to %s model object before it has an ID. You can solve that by just saving it before trying to get its related model objects", | 
                                                        |
| 310 | - "event_espresso"), $this->get_other_model()->get_this_model_name(),  | 
                                                        |
| 311 | - $this->get_this_model()->get_this_model_name()));  | 
                                                        |
| 312 | - }  | 
                                                        |
| 313 | - return $model_object_id;  | 
                                                        |
| 314 | - }  | 
                                                        |
| 315 | -  | 
                                                        |
| 316 | -  | 
                                                        |
| 317 | - /**  | 
                                                        |
| 318 | - * Gets the SQL string for performing the join between this model and the other model.  | 
                                                        |
| 319 | - *  | 
                                                        |
| 320 | - * @param string $model_relation_chain like 'Event.Event_Venue.Venue'  | 
                                                        |
| 321 | - * @return string of SQL, eg "LEFT JOIN table_name AS table_alias ON this_model_primary_table.pk =  | 
                                                        |
| 322 | - * other_model_primary_table.fk" etc  | 
                                                        |
| 323 | - */  | 
                                                        |
| 324 | - abstract public function get_join_statement($model_relation_chain);  | 
                                                        |
| 325 | -  | 
                                                        |
| 326 | -  | 
                                                        |
| 327 | - /**  | 
                                                        |
| 328 | - * Adds a relationships between the two model objects provided. Each type of relationship handles this differently  | 
                                                        |
| 329 | - * (EE_Belongs_To is a slight exception, it should more accurately be called set_relation_to(...), as this  | 
                                                        |
| 330 | - * relationship only allows this model to be related to a single other model of this type)  | 
                                                        |
| 331 | - *  | 
                                                        |
| 332 | - * @param $this_obj_or_id  | 
                                                        |
| 333 | - * @param $other_obj_or_id  | 
                                                        |
| 334 | - * @param array $extra_join_model_fields_n_values  | 
                                                        |
| 335 | - * @return \EE_Base_Class the EE_Base_Class which was added as a relation. (Convenient if you only pass an ID for  | 
                                                        |
| 336 | - * $other_obj_or_id)  | 
                                                        |
| 337 | - */  | 
                                                        |
| 338 | - abstract public function add_relation_to(  | 
                                                        |
| 339 | - $this_obj_or_id,  | 
                                                        |
| 340 | - $other_obj_or_id,  | 
                                                        |
| 341 | - $extra_join_model_fields_n_values = array()  | 
                                                        |
| 342 | - );  | 
                                                        |
| 343 | -  | 
                                                        |
| 344 | -  | 
                                                        |
| 345 | - /**  | 
                                                        |
| 346 | - * Similar to 'add_relation_to(...)', performs the opposite action of removing the relationship between the two  | 
                                                        |
| 347 | - * model objects  | 
                                                        |
| 348 | - *  | 
                                                        |
| 349 | - * @param $this_obj_or_id  | 
                                                        |
| 350 | - * @param $other_obj_or_id  | 
                                                        |
| 351 | - * @param array $where_query  | 
                                                        |
| 352 | - * @return bool  | 
                                                        |
| 353 | - */  | 
                                                        |
| 354 | - abstract public function remove_relation_to($this_obj_or_id, $other_obj_or_id, $where_query = array());  | 
                                                        |
| 355 | -  | 
                                                        |
| 356 | -  | 
                                                        |
| 357 | - /**  | 
                                                        |
| 358 | - * Removes ALL relation instances for this relation obj  | 
                                                        |
| 359 | - *  | 
                                                        |
| 360 | - * @param EE_Base_Class|int $this_obj_or_id  | 
                                                        |
| 361 | - * @param array $where_query_param like EEM_Base::get_all's $query_params[0] (where conditions)  | 
                                                        |
| 362 | - * @return EE_Base_Class[]  | 
                                                        |
| 363 | - * @throws \EE_Error  | 
                                                        |
| 364 | - */  | 
                                                        |
| 365 | - public function remove_relations($this_obj_or_id, $where_query_param = array())  | 
                                                        |
| 366 | -    { | 
                                                        |
| 367 | - $related_things = $this->get_all_related($this_obj_or_id, array($where_query_param));  | 
                                                        |
| 368 | - $objs_removed = array();  | 
                                                        |
| 369 | -        foreach ($related_things as $related_thing) { | 
                                                        |
| 370 | - $objs_removed[] = $this->remove_relation_to($this_obj_or_id, $related_thing);  | 
                                                        |
| 371 | - }  | 
                                                        |
| 372 | - return $objs_removed;  | 
                                                        |
| 373 | - }  | 
                                                        |
| 374 | -  | 
                                                        |
| 375 | -  | 
                                                        |
| 376 | - /**  | 
                                                        |
| 377 | - * If you aren't allowed to delete this model when there are related models across this  | 
                                                        |
| 378 | - * relation object, return true. Otherwise, if you can delete this model even though  | 
                                                        |
| 379 | - * related objects exist, returns false.  | 
                                                        |
| 380 | - *  | 
                                                        |
| 381 | - * @return boolean  | 
                                                        |
| 382 | - */  | 
                                                        |
| 383 | - public function block_delete_if_related_models_exist()  | 
                                                        |
| 384 | -    { | 
                                                        |
| 385 | - return $this->_blocking_delete;  | 
                                                        |
| 386 | - }  | 
                                                        |
| 387 | -  | 
                                                        |
| 388 | -  | 
                                                        |
| 389 | - /**  | 
                                                        |
| 390 | - * Gets the error message to show  | 
                                                        |
| 391 | - *  | 
                                                        |
| 392 | - * @return string  | 
                                                        |
| 393 | - */  | 
                                                        |
| 394 | - public function get_deletion_error_message()  | 
                                                        |
| 395 | -    { | 
                                                        |
| 396 | -        if ($this->_blocking_delete_error_message) { | 
                                                        |
| 397 | - return $this->_blocking_delete_error_message;  | 
                                                        |
| 398 | -        } else { | 
                                                        |
| 20 | + /**  | 
                                                        |
| 21 | + * The model name of which this relation is a component (ie, the model that called new EE_Model_Relation_Base)  | 
                                                        |
| 22 | + *  | 
                                                        |
| 23 | + * @var string eg Event, Question_Group, Registration  | 
                                                        |
| 24 | + */  | 
                                                        |
| 25 | + private $_this_model_name;  | 
                                                        |
| 26 | + /**  | 
                                                        |
| 27 | + * The model name pointed to by this relation (ie, the model we want to establish a relationship to)  | 
                                                        |
| 28 | + *  | 
                                                        |
| 29 | + * @var string eg Event, Question_Group, Registration  | 
                                                        |
| 30 | + */  | 
                                                        |
| 31 | + private $_other_model_name;  | 
                                                        |
| 32 | +  | 
                                                        |
| 33 | + /**  | 
                                                        |
| 34 | + * this is typically used when calling the relation models to make sure they inherit any set timezone from the  | 
                                                        |
| 35 | + * initiating model.  | 
                                                        |
| 36 | + *  | 
                                                        |
| 37 | + * @var string  | 
                                                        |
| 38 | + */  | 
                                                        |
| 39 | + protected $_timezone;  | 
                                                        |
| 40 | +  | 
                                                        |
| 41 | + /**  | 
                                                        |
| 42 | + * If you try to delete "this_model", and there are related "other_models",  | 
                                                        |
| 43 | + * and this isn't null, then abandon the deletion and add this warning.  | 
                                                        |
| 44 | + * This effectively makes it impossible to delete "this_model" while there are  | 
                                                        |
| 45 | + * related "other_models" along this relation.  | 
                                                        |
| 46 | + *  | 
                                                        |
| 47 | + * @var string (internationalized)  | 
                                                        |
| 48 | + */  | 
                                                        |
| 49 | + protected $_blocking_delete_error_message;  | 
                                                        |
| 50 | +  | 
                                                        |
| 51 | + protected $_blocking_delete = false;  | 
                                                        |
| 52 | +  | 
                                                        |
| 53 | + /**  | 
                                                        |
| 54 | + * Object representing the relationship between two models. This knows how to join the models,  | 
                                                        |
| 55 | + * get related models across the relation, and add-and-remove the relationships.  | 
                                                        |
| 56 | + *  | 
                                                        |
| 57 | + * @param boolean $block_deletes if there are related models across this relation, block (prevent  | 
                                                        |
| 58 | + * and add an error) the deletion of this model  | 
                                                        |
| 59 | + * @param string $blocking_delete_error_message a customized error message on blocking deletes instead of the  | 
                                                        |
| 60 | + * default  | 
                                                        |
| 61 | + */  | 
                                                        |
| 62 | + public function __construct($block_deletes, $blocking_delete_error_message)  | 
                                                        |
| 63 | +	{ | 
                                                        |
| 64 | + $this->_blocking_delete = $block_deletes;  | 
                                                        |
| 65 | + $this->_blocking_delete_error_message = $blocking_delete_error_message;  | 
                                                        |
| 66 | + }  | 
                                                        |
| 67 | +  | 
                                                        |
| 68 | +  | 
                                                        |
| 69 | + /**  | 
                                                        |
| 70 | + * @param $this_model_name  | 
                                                        |
| 71 | + * @param $other_model_name  | 
                                                        |
| 72 | + * @throws EE_Error  | 
                                                        |
| 73 | + */  | 
                                                        |
| 74 | + public function _construct_finalize_set_models($this_model_name, $other_model_name)  | 
                                                        |
| 75 | +	{ | 
                                                        |
| 76 | + $this->_this_model_name = $this_model_name;  | 
                                                        |
| 77 | + $this->_other_model_name = $other_model_name;  | 
                                                        |
| 78 | +		if (is_string($this->_blocking_delete)) { | 
                                                        |
| 79 | +			throw new EE_Error(sprintf(__("When instantiating the relation of type %s from %s to %s, the \$block_deletes argument should be a boolean, not a string (%s)", | 
                                                        |
| 80 | + "event_espresso"),  | 
                                                        |
| 81 | + get_class($this), $this_model_name, $other_model_name, $this->_blocking_delete));  | 
                                                        |
| 82 | + }  | 
                                                        |
| 83 | + }  | 
                                                        |
| 84 | +  | 
                                                        |
| 85 | +  | 
                                                        |
| 86 | + /**  | 
                                                        |
| 87 | + * Gets the model where this relation is defined.  | 
                                                        |
| 88 | + *  | 
                                                        |
| 89 | + * @return EEM_Base  | 
                                                        |
| 90 | + */  | 
                                                        |
| 91 | + public function get_this_model()  | 
                                                        |
| 92 | +	{ | 
                                                        |
| 93 | + return $this->_get_model($this->_this_model_name);  | 
                                                        |
| 94 | + }  | 
                                                        |
| 95 | +  | 
                                                        |
| 96 | +  | 
                                                        |
| 97 | + /**  | 
                                                        |
| 98 | + * Gets the model which this relation establishes the relation TO (ie,  | 
                                                        |
| 99 | + * this relation object was defined on get_this_model(), get_other_model() is the other one)  | 
                                                        |
| 100 | + *  | 
                                                        |
| 101 | + * @return EEM_Base  | 
                                                        |
| 102 | + */  | 
                                                        |
| 103 | + public function get_other_model()  | 
                                                        |
| 104 | +	{ | 
                                                        |
| 105 | + return $this->_get_model($this->_other_model_name);  | 
                                                        |
| 106 | + }  | 
                                                        |
| 107 | +  | 
                                                        |
| 108 | +  | 
                                                        |
| 109 | + /**  | 
                                                        |
| 110 | + * Internally used by get_this_model() and get_other_model()  | 
                                                        |
| 111 | + *  | 
                                                        |
| 112 | + * @param string $model_name like Event, Question_Group, etc. omit the EEM_  | 
                                                        |
| 113 | + * @return EEM_Base  | 
                                                        |
| 114 | + * @throws EE_Error  | 
                                                        |
| 115 | + * @throws InvalidArgumentException  | 
                                                        |
| 116 | + * @throws ReflectionException  | 
                                                        |
| 117 | + * @throws RuntimeException  | 
                                                        |
| 118 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException  | 
                                                        |
| 119 | + * @throws \EventEspresso\core\exceptions\InvalidInterfaceException  | 
                                                        |
| 120 | + */  | 
                                                        |
| 121 | + protected function _get_model($model_name)  | 
                                                        |
| 122 | +	{ | 
                                                        |
| 123 | +		if(empty($model_name)) { | 
                                                        |
| 124 | + throw new RuntimeException(  | 
                                                        |
| 125 | + sprintf(  | 
                                                        |
| 126 | +					esc_html__('Invalid Model name provided: "%1$s".', 'event_espresso'), | 
                                                        |
| 127 | + $model_name  | 
                                                        |
| 128 | + )  | 
                                                        |
| 129 | + );  | 
                                                        |
| 130 | + }  | 
                                                        |
| 131 | + $modelInstance = EE_Registry::instance()->load_model($model_name);  | 
                                                        |
| 132 | + $modelInstance->set_timezone($this->_timezone);  | 
                                                        |
| 133 | + return $modelInstance;  | 
                                                        |
| 134 | + }  | 
                                                        |
| 135 | +  | 
                                                        |
| 136 | +  | 
                                                        |
| 137 | + /**  | 
                                                        |
| 138 | + * entirely possible that relations may be called from a model and we need to make sure those relations have their  | 
                                                        |
| 139 | + * timezone set correctly.  | 
                                                        |
| 140 | + *  | 
                                                        |
| 141 | + * @param string $timezone timezone to set.  | 
                                                        |
| 142 | + */  | 
                                                        |
| 143 | + public function set_timezone($timezone)  | 
                                                        |
| 144 | +	{ | 
                                                        |
| 145 | +		if ($timezone !== null) { | 
                                                        |
| 146 | + $this->_timezone = $timezone;  | 
                                                        |
| 147 | + }  | 
                                                        |
| 148 | + }  | 
                                                        |
| 149 | +  | 
                                                        |
| 150 | +  | 
                                                        |
| 151 | + /**  | 
                                                        |
| 152 | + * @param $other_table  | 
                                                        |
| 153 | + * @param $other_table_alias  | 
                                                        |
| 154 | + * @param $other_table_column  | 
                                                        |
| 155 | + * @param $this_table_alias  | 
                                                        |
| 156 | + * @param $this_table_join_column  | 
                                                        |
| 157 | + * @param string $extra_join_sql  | 
                                                        |
| 158 | + * @return string  | 
                                                        |
| 159 | + */  | 
                                                        |
| 160 | + protected function _left_join(  | 
                                                        |
| 161 | + $other_table,  | 
                                                        |
| 162 | + $other_table_alias,  | 
                                                        |
| 163 | + $other_table_column,  | 
                                                        |
| 164 | + $this_table_alias,  | 
                                                        |
| 165 | + $this_table_join_column,  | 
                                                        |
| 166 | + $extra_join_sql = ''  | 
                                                        |
| 167 | +	) { | 
                                                        |
| 168 | + return " LEFT JOIN " . $other_table . " AS " . $other_table_alias . " ON " . $other_table_alias . "." . $other_table_column . "=" . $this_table_alias . "." . $this_table_join_column . ($extra_join_sql ? " AND $extra_join_sql" : '');  | 
                                                        |
| 169 | + }  | 
                                                        |
| 170 | +  | 
                                                        |
| 171 | +  | 
                                                        |
| 172 | + /**  | 
                                                        |
| 173 | + * Gets all the model objects of type of other model related to $model_object,  | 
                                                        |
| 174 | + * according to this relation. This is the same code for EE_HABTM_Relation and EE_Has_Many_Relation.  | 
                                                        |
| 175 | + * For both of those child classes, $model_object must be saved so that it has an ID before querying,  | 
                                                        |
| 176 | + * otherwise an error will be thrown. Note: by default we disable default_where_conditions  | 
                                                        |
| 177 | + * EE_Belongs_To_Relation doesn't need to be saved before querying.  | 
                                                        |
| 178 | + *  | 
                                                        |
| 179 | + * @param EE_Base_Class|int $model_object_or_id or the primary key of this model  | 
                                                        |
| 180 | + * @param array $query_params like EEM_Base::get_all's $query_params  | 
                                                        |
| 181 | + * @param boolean $values_already_prepared_by_model_object @deprecated since 4.8.1  | 
                                                        |
| 182 | + * @return EE_Base_Class[]  | 
                                                        |
| 183 | + * @throws \EE_Error  | 
                                                        |
| 184 | + */  | 
                                                        |
| 185 | + public function get_all_related(  | 
                                                        |
| 186 | + $model_object_or_id,  | 
                                                        |
| 187 | + $query_params = array(),  | 
                                                        |
| 188 | + $values_already_prepared_by_model_object = false  | 
                                                        |
| 189 | +	) { | 
                                                        |
| 190 | +		if ($values_already_prepared_by_model_object !== false) { | 
                                                        |
| 191 | +			EE_Error::doing_it_wrong('EE_Model_Relation_Base::get_all_related', | 
                                                        |
| 192 | +				__('The argument $values_already_prepared_by_model_object is no longer used.', 'event_espresso'), | 
                                                        |
| 193 | + '4.8.1');  | 
                                                        |
| 194 | + }  | 
                                                        |
| 195 | + $query_params = $this->_disable_default_where_conditions_on_query_param($query_params);  | 
                                                        |
| 196 | + $query_param_where_this_model_pk = $this->get_this_model()->get_this_model_name()  | 
                                                        |
| 197 | + . "."  | 
                                                        |
| 198 | + . $this->get_this_model()->get_primary_key_field()->get_name();  | 
                                                        |
| 199 | + $model_object_id = $this->_get_model_object_id($model_object_or_id);  | 
                                                        |
| 200 | + $query_params[0][$query_param_where_this_model_pk] = $model_object_id;  | 
                                                        |
| 201 | + return $this->get_other_model()->get_all($query_params);  | 
                                                        |
| 202 | + }  | 
                                                        |
| 203 | +  | 
                                                        |
| 204 | +  | 
                                                        |
| 205 | + /**  | 
                                                        |
| 206 | + * Alters the $query_params to disable default where conditions, unless otherwise specified  | 
                                                        |
| 207 | + *  | 
                                                        |
| 208 | + * @param string $query_params  | 
                                                        |
| 209 | + * @return array  | 
                                                        |
| 210 | + */  | 
                                                        |
| 211 | + protected function _disable_default_where_conditions_on_query_param($query_params)  | 
                                                        |
| 212 | +	{ | 
                                                        |
| 213 | +		if (! isset($query_params['default_where_conditions'])) { | 
                                                        |
| 214 | + $query_params['default_where_conditions'] = 'none';  | 
                                                        |
| 215 | + }  | 
                                                        |
| 216 | + return $query_params;  | 
                                                        |
| 217 | + }  | 
                                                        |
| 218 | +  | 
                                                        |
| 219 | +  | 
                                                        |
| 220 | + /**  | 
                                                        |
| 221 | + * Deletes the related model objects which meet the query parameters. If no  | 
                                                        |
| 222 | + * parameters are specified, then all related model objects will be deleted.  | 
                                                        |
| 223 | + * Note: If the related model is extends EEM_Soft_Delete_Base, then the related  | 
                                                        |
| 224 | + * model objects will only be soft-deleted.  | 
                                                        |
| 225 | + *  | 
                                                        |
| 226 | + * @param EE_Base_Class|int|string $model_object_or_id  | 
                                                        |
| 227 | + * @param array $query_params  | 
                                                        |
| 228 | + * @return int of how many related models got deleted  | 
                                                        |
| 229 | + * @throws \EE_Error  | 
                                                        |
| 230 | + */  | 
                                                        |
| 231 | + public function delete_all_related($model_object_or_id, $query_params = array())  | 
                                                        |
| 232 | +	{ | 
                                                        |
| 233 | + //for each thing we would delete,  | 
                                                        |
| 234 | + $related_model_objects = $this->get_all_related($model_object_or_id, $query_params);  | 
                                                        |
| 235 | + //determine if it's blocked by anything else before it can be deleted  | 
                                                        |
| 236 | + $deleted_count = 0;  | 
                                                        |
| 237 | +		foreach ($related_model_objects as $related_model_object) { | 
                                                        |
| 238 | + $delete_is_blocked = $this->get_other_model()->delete_is_blocked_by_related_models($related_model_object,  | 
                                                        |
| 239 | + $model_object_or_id);  | 
                                                        |
| 240 | + /* @var $model_object_or_id EE_Base_Class */  | 
                                                        |
| 241 | +			if (! $delete_is_blocked) { | 
                                                        |
| 242 | + $this->remove_relation_to($model_object_or_id, $related_model_object);  | 
                                                        |
| 243 | + $related_model_object->delete();  | 
                                                        |
| 244 | + $deleted_count++;  | 
                                                        |
| 245 | + }  | 
                                                        |
| 246 | + }  | 
                                                        |
| 247 | + return $deleted_count;  | 
                                                        |
| 248 | + }  | 
                                                        |
| 249 | +  | 
                                                        |
| 250 | +  | 
                                                        |
| 251 | + /**  | 
                                                        |
| 252 | + * Deletes the related model objects which meet the query parameters. If no  | 
                                                        |
| 253 | + * parameters are specified, then all related model objects will be deleted.  | 
                                                        |
| 254 | + * Note: If the related model is extends EEM_Soft_Delete_Base, then the related  | 
                                                        |
| 255 | + * model objects will only be soft-deleted.  | 
                                                        |
| 256 | + *  | 
                                                        |
| 257 | + * @param EE_Base_Class|int|string $model_object_or_id  | 
                                                        |
| 258 | + * @param array $query_params  | 
                                                        |
| 259 | + * @return int of how many related models got deleted  | 
                                                        |
| 260 | + * @throws \EE_Error  | 
                                                        |
| 261 | + */  | 
                                                        |
| 262 | + public function delete_related_permanently($model_object_or_id, $query_params = array())  | 
                                                        |
| 263 | +	{ | 
                                                        |
| 264 | + //for each thing we would delete,  | 
                                                        |
| 265 | + $related_model_objects = $this->get_all_related($model_object_or_id, $query_params);  | 
                                                        |
| 266 | + //determine if it's blocked by anything else before it can be deleted  | 
                                                        |
| 267 | + $deleted_count = 0;  | 
                                                        |
| 268 | +		foreach ($related_model_objects as $related_model_object) { | 
                                                        |
| 269 | + $delete_is_blocked = $this->get_other_model()->delete_is_blocked_by_related_models($related_model_object,  | 
                                                        |
| 270 | + $model_object_or_id);  | 
                                                        |
| 271 | + /* @var $model_object_or_id EE_Base_Class */  | 
                                                        |
| 272 | +			if ($related_model_object instanceof EE_Soft_Delete_Base_Class) { | 
                                                        |
| 273 | + $this->remove_relation_to($model_object_or_id, $related_model_object);  | 
                                                        |
| 274 | + $deleted_count++;  | 
                                                        |
| 275 | +				if (! $delete_is_blocked) { | 
                                                        |
| 276 | + $related_model_object->delete_permanently();  | 
                                                        |
| 277 | +				} else { | 
                                                        |
| 278 | + //delete is blocked  | 
                                                        |
| 279 | + //brent and darren, in this case, wanted to just soft delete it then  | 
                                                        |
| 280 | + $related_model_object->delete();  | 
                                                        |
| 281 | + }  | 
                                                        |
| 282 | +			} else { | 
                                                        |
| 283 | + //its not a soft-deletable thing anyways. do the normal logic.  | 
                                                        |
| 284 | +				if (! $delete_is_blocked) { | 
                                                        |
| 285 | + $this->remove_relation_to($model_object_or_id, $related_model_object);  | 
                                                        |
| 286 | + $related_model_object->delete();  | 
                                                        |
| 287 | + $deleted_count++;  | 
                                                        |
| 288 | + }  | 
                                                        |
| 289 | + }  | 
                                                        |
| 290 | + }  | 
                                                        |
| 291 | + return $deleted_count;  | 
                                                        |
| 292 | + }  | 
                                                        |
| 293 | +  | 
                                                        |
| 294 | +  | 
                                                        |
| 295 | + /**  | 
                                                        |
| 296 | + * this just returns a model_object_id for incoming item that could be an object or id.  | 
                                                        |
| 297 | + *  | 
                                                        |
| 298 | + * @param EE_Base_Class|int $model_object_or_id model object or the primary key of this model  | 
                                                        |
| 299 | + * @throws EE_Error  | 
                                                        |
| 300 | + * @return int  | 
                                                        |
| 301 | + */  | 
                                                        |
| 302 | + protected function _get_model_object_id($model_object_or_id)  | 
                                                        |
| 303 | +	{ | 
                                                        |
| 304 | + $model_object_id = $model_object_or_id;  | 
                                                        |
| 305 | +		if ($model_object_or_id instanceof EE_Base_Class) { | 
                                                        |
| 306 | + $model_object_id = $model_object_or_id->ID();  | 
                                                        |
| 307 | + }  | 
                                                        |
| 308 | +		if (! $model_object_id) { | 
                                                        |
| 309 | +			throw new EE_Error(sprintf(__("Sorry, we cant get the related %s model objects to %s model object before it has an ID. You can solve that by just saving it before trying to get its related model objects", | 
                                                        |
| 310 | + "event_espresso"), $this->get_other_model()->get_this_model_name(),  | 
                                                        |
| 311 | + $this->get_this_model()->get_this_model_name()));  | 
                                                        |
| 312 | + }  | 
                                                        |
| 313 | + return $model_object_id;  | 
                                                        |
| 314 | + }  | 
                                                        |
| 315 | +  | 
                                                        |
| 316 | +  | 
                                                        |
| 317 | + /**  | 
                                                        |
| 318 | + * Gets the SQL string for performing the join between this model and the other model.  | 
                                                        |
| 319 | + *  | 
                                                        |
| 320 | + * @param string $model_relation_chain like 'Event.Event_Venue.Venue'  | 
                                                        |
| 321 | + * @return string of SQL, eg "LEFT JOIN table_name AS table_alias ON this_model_primary_table.pk =  | 
                                                        |
| 322 | + * other_model_primary_table.fk" etc  | 
                                                        |
| 323 | + */  | 
                                                        |
| 324 | + abstract public function get_join_statement($model_relation_chain);  | 
                                                        |
| 325 | +  | 
                                                        |
| 326 | +  | 
                                                        |
| 327 | + /**  | 
                                                        |
| 328 | + * Adds a relationships between the two model objects provided. Each type of relationship handles this differently  | 
                                                        |
| 329 | + * (EE_Belongs_To is a slight exception, it should more accurately be called set_relation_to(...), as this  | 
                                                        |
| 330 | + * relationship only allows this model to be related to a single other model of this type)  | 
                                                        |
| 331 | + *  | 
                                                        |
| 332 | + * @param $this_obj_or_id  | 
                                                        |
| 333 | + * @param $other_obj_or_id  | 
                                                        |
| 334 | + * @param array $extra_join_model_fields_n_values  | 
                                                        |
| 335 | + * @return \EE_Base_Class the EE_Base_Class which was added as a relation. (Convenient if you only pass an ID for  | 
                                                        |
| 336 | + * $other_obj_or_id)  | 
                                                        |
| 337 | + */  | 
                                                        |
| 338 | + abstract public function add_relation_to(  | 
                                                        |
| 339 | + $this_obj_or_id,  | 
                                                        |
| 340 | + $other_obj_or_id,  | 
                                                        |
| 341 | + $extra_join_model_fields_n_values = array()  | 
                                                        |
| 342 | + );  | 
                                                        |
| 343 | +  | 
                                                        |
| 344 | +  | 
                                                        |
| 345 | + /**  | 
                                                        |
| 346 | + * Similar to 'add_relation_to(...)', performs the opposite action of removing the relationship between the two  | 
                                                        |
| 347 | + * model objects  | 
                                                        |
| 348 | + *  | 
                                                        |
| 349 | + * @param $this_obj_or_id  | 
                                                        |
| 350 | + * @param $other_obj_or_id  | 
                                                        |
| 351 | + * @param array $where_query  | 
                                                        |
| 352 | + * @return bool  | 
                                                        |
| 353 | + */  | 
                                                        |
| 354 | + abstract public function remove_relation_to($this_obj_or_id, $other_obj_or_id, $where_query = array());  | 
                                                        |
| 355 | +  | 
                                                        |
| 356 | +  | 
                                                        |
| 357 | + /**  | 
                                                        |
| 358 | + * Removes ALL relation instances for this relation obj  | 
                                                        |
| 359 | + *  | 
                                                        |
| 360 | + * @param EE_Base_Class|int $this_obj_or_id  | 
                                                        |
| 361 | + * @param array $where_query_param like EEM_Base::get_all's $query_params[0] (where conditions)  | 
                                                        |
| 362 | + * @return EE_Base_Class[]  | 
                                                        |
| 363 | + * @throws \EE_Error  | 
                                                        |
| 364 | + */  | 
                                                        |
| 365 | + public function remove_relations($this_obj_or_id, $where_query_param = array())  | 
                                                        |
| 366 | +	{ | 
                                                        |
| 367 | + $related_things = $this->get_all_related($this_obj_or_id, array($where_query_param));  | 
                                                        |
| 368 | + $objs_removed = array();  | 
                                                        |
| 369 | +		foreach ($related_things as $related_thing) { | 
                                                        |
| 370 | + $objs_removed[] = $this->remove_relation_to($this_obj_or_id, $related_thing);  | 
                                                        |
| 371 | + }  | 
                                                        |
| 372 | + return $objs_removed;  | 
                                                        |
| 373 | + }  | 
                                                        |
| 374 | +  | 
                                                        |
| 375 | +  | 
                                                        |
| 376 | + /**  | 
                                                        |
| 377 | + * If you aren't allowed to delete this model when there are related models across this  | 
                                                        |
| 378 | + * relation object, return true. Otherwise, if you can delete this model even though  | 
                                                        |
| 379 | + * related objects exist, returns false.  | 
                                                        |
| 380 | + *  | 
                                                        |
| 381 | + * @return boolean  | 
                                                        |
| 382 | + */  | 
                                                        |
| 383 | + public function block_delete_if_related_models_exist()  | 
                                                        |
| 384 | +	{ | 
                                                        |
| 385 | + return $this->_blocking_delete;  | 
                                                        |
| 386 | + }  | 
                                                        |
| 387 | +  | 
                                                        |
| 388 | +  | 
                                                        |
| 389 | + /**  | 
                                                        |
| 390 | + * Gets the error message to show  | 
                                                        |
| 391 | + *  | 
                                                        |
| 392 | + * @return string  | 
                                                        |
| 393 | + */  | 
                                                        |
| 394 | + public function get_deletion_error_message()  | 
                                                        |
| 395 | +	{ | 
                                                        |
| 396 | +		if ($this->_blocking_delete_error_message) { | 
                                                        |
| 397 | + return $this->_blocking_delete_error_message;  | 
                                                        |
| 398 | +		} else { | 
                                                        |
| 399 | 399 |  //			return sprintf(__('Cannot delete %1$s when there are related %2$s', "event_espresso"),$this->get_this_model()->item_name(2),$this->get_other_model()->item_name(2)); | 
                                                        
| 400 | - return sprintf(  | 
                                                        |
| 401 | -                __('This %1$s is currently linked to one or more %2$s records. If this %1$s is incorrect, then please remove it from all %3$s before attempting to delete it.', | 
                                                        |
| 402 | - "event_espresso"),  | 
                                                        |
| 403 | - $this->get_this_model()->item_name(1),  | 
                                                        |
| 404 | - $this->get_other_model()->item_name(1),  | 
                                                        |
| 405 | - $this->get_other_model()->item_name(2)  | 
                                                        |
| 406 | - );  | 
                                                        |
| 407 | - }  | 
                                                        |
| 408 | - }  | 
                                                        |
| 409 | -  | 
                                                        |
| 410 | - /**  | 
                                                        |
| 411 | - * Returns whatever is set as the nicename for the object.  | 
                                                        |
| 412 | - *  | 
                                                        |
| 413 | - * @return string  | 
                                                        |
| 414 | - */  | 
                                                        |
| 415 | - public function getSchemaDescription()  | 
                                                        |
| 416 | -    { | 
                                                        |
| 417 | - $description = $this instanceof EE_Belongs_To_Relation  | 
                                                        |
| 418 | -            ? esc_html__('The related %1$s entity to the %2$s.', 'event_espresso') | 
                                                        |
| 419 | -            : esc_html__('The related %1$s entities to the %2$s.', 'event_espresso'); | 
                                                        |
| 420 | - return sprintf(  | 
                                                        |
| 421 | - $description,  | 
                                                        |
| 422 | - $this->get_other_model()->get_this_model_name(),  | 
                                                        |
| 423 | - $this->get_this_model()->get_this_model_name()  | 
                                                        |
| 424 | - );  | 
                                                        |
| 425 | - }  | 
                                                        |
| 426 | -  | 
                                                        |
| 427 | - /**  | 
                                                        |
| 428 | - * Returns whatever is set as the $_schema_type property for the object.  | 
                                                        |
| 429 | - * Note: this will automatically add 'null' to the schema if the object is_nullable()  | 
                                                        |
| 430 | - *  | 
                                                        |
| 431 | - * @return string|array  | 
                                                        |
| 432 | - */  | 
                                                        |
| 433 | - public function getSchemaType()  | 
                                                        |
| 434 | -    { | 
                                                        |
| 435 | - return $this instanceof EE_Belongs_To_Relation ? 'object' : 'array';  | 
                                                        |
| 436 | - }  | 
                                                        |
| 437 | -  | 
                                                        |
| 438 | - /**  | 
                                                        |
| 439 | - * This is usually present when the $_schema_type property is 'object'. Any child classes will need to override  | 
                                                        |
| 440 | - * this method and return the properties for the schema.  | 
                                                        |
| 441 | - * The reason this is not a property on the class is because there may be filters set on the values for the property  | 
                                                        |
| 442 | - * that won't be exposed on construct. For example enum type schemas may have the enum values filtered.  | 
                                                        |
| 443 | - *  | 
                                                        |
| 444 | - * @return array  | 
                                                        |
| 445 | - */  | 
                                                        |
| 446 | - public function getSchemaProperties()  | 
                                                        |
| 447 | -    { | 
                                                        |
| 448 | - return array();  | 
                                                        |
| 449 | - }  | 
                                                        |
| 450 | -  | 
                                                        |
| 451 | - /**  | 
                                                        |
| 452 | - * If a child class has enum values, they should override this method and provide a simple array  | 
                                                        |
| 453 | - * of the enum values.  | 
                                                        |
| 454 | - * The reason this is not a property on the class is because there may be filterable enum values that  | 
                                                        |
| 455 | - * are set on the instantiated object that could be filtered after construct.  | 
                                                        |
| 456 | - *  | 
                                                        |
| 457 | - * @return array  | 
                                                        |
| 458 | - */  | 
                                                        |
| 459 | - public function getSchemaEnum()  | 
                                                        |
| 460 | -    { | 
                                                        |
| 461 | - return array();  | 
                                                        |
| 462 | - }  | 
                                                        |
| 463 | -  | 
                                                        |
| 464 | - /**  | 
                                                        |
| 465 | - * This returns the value of the $_schema_format property on the object.  | 
                                                        |
| 466 | - *  | 
                                                        |
| 467 | - * @return string  | 
                                                        |
| 468 | - */  | 
                                                        |
| 469 | - public function getSchemaFormat()  | 
                                                        |
| 470 | -    { | 
                                                        |
| 471 | - return array();  | 
                                                        |
| 472 | - }  | 
                                                        |
| 473 | -  | 
                                                        |
| 474 | - /**  | 
                                                        |
| 475 | - * This returns the value of the $_schema_readonly property on the object.  | 
                                                        |
| 476 | - *  | 
                                                        |
| 477 | - * @return bool  | 
                                                        |
| 478 | - */  | 
                                                        |
| 479 | - public function getSchemaReadonly()  | 
                                                        |
| 480 | -    { | 
                                                        |
| 481 | - return true;  | 
                                                        |
| 482 | - }  | 
                                                        |
| 483 | -  | 
                                                        |
| 484 | - /**  | 
                                                        |
| 485 | - * This returns elements used to represent this field in the json schema.  | 
                                                        |
| 486 | - *  | 
                                                        |
| 487 | - * @link http://json-schema.org/  | 
                                                        |
| 488 | - * @return array  | 
                                                        |
| 489 | - */  | 
                                                        |
| 490 | - public function getSchema()  | 
                                                        |
| 491 | -    { | 
                                                        |
| 492 | - $schema = array(  | 
                                                        |
| 493 | - 'description' => $this->getSchemaDescription(),  | 
                                                        |
| 494 | - 'type' => $this->getSchemaType(),  | 
                                                        |
| 495 | - 'relation' => true,  | 
                                                        |
| 496 | - 'relation_type' => get_class($this),  | 
                                                        |
| 497 | - 'readonly' => $this->getSchemaReadonly()  | 
                                                        |
| 498 | - );  | 
                                                        |
| 499 | -  | 
                                                        |
| 500 | -        if ($this instanceof EE_HABTM_Relation) { | 
                                                        |
| 501 | - $schema['joining_model_name'] = $this->get_join_model()->get_this_model_name();  | 
                                                        |
| 502 | - }  | 
                                                        |
| 503 | -  | 
                                                        |
| 504 | -        if ($this->getSchemaType() === 'array') { | 
                                                        |
| 505 | - $schema['items'] = array(  | 
                                                        |
| 506 | - 'type' => 'object'  | 
                                                        |
| 507 | - );  | 
                                                        |
| 508 | - }  | 
                                                        |
| 509 | -  | 
                                                        |
| 510 | - return $schema;  | 
                                                        |
| 511 | - }  | 
                                                        |
| 400 | + return sprintf(  | 
                                                        |
| 401 | +				__('This %1$s is currently linked to one or more %2$s records. If this %1$s is incorrect, then please remove it from all %3$s before attempting to delete it.', | 
                                                        |
| 402 | + "event_espresso"),  | 
                                                        |
| 403 | + $this->get_this_model()->item_name(1),  | 
                                                        |
| 404 | + $this->get_other_model()->item_name(1),  | 
                                                        |
| 405 | + $this->get_other_model()->item_name(2)  | 
                                                        |
| 406 | + );  | 
                                                        |
| 407 | + }  | 
                                                        |
| 408 | + }  | 
                                                        |
| 409 | +  | 
                                                        |
| 410 | + /**  | 
                                                        |
| 411 | + * Returns whatever is set as the nicename for the object.  | 
                                                        |
| 412 | + *  | 
                                                        |
| 413 | + * @return string  | 
                                                        |
| 414 | + */  | 
                                                        |
| 415 | + public function getSchemaDescription()  | 
                                                        |
| 416 | +	{ | 
                                                        |
| 417 | + $description = $this instanceof EE_Belongs_To_Relation  | 
                                                        |
| 418 | +			? esc_html__('The related %1$s entity to the %2$s.', 'event_espresso') | 
                                                        |
| 419 | +			: esc_html__('The related %1$s entities to the %2$s.', 'event_espresso'); | 
                                                        |
| 420 | + return sprintf(  | 
                                                        |
| 421 | + $description,  | 
                                                        |
| 422 | + $this->get_other_model()->get_this_model_name(),  | 
                                                        |
| 423 | + $this->get_this_model()->get_this_model_name()  | 
                                                        |
| 424 | + );  | 
                                                        |
| 425 | + }  | 
                                                        |
| 426 | +  | 
                                                        |
| 427 | + /**  | 
                                                        |
| 428 | + * Returns whatever is set as the $_schema_type property for the object.  | 
                                                        |
| 429 | + * Note: this will automatically add 'null' to the schema if the object is_nullable()  | 
                                                        |
| 430 | + *  | 
                                                        |
| 431 | + * @return string|array  | 
                                                        |
| 432 | + */  | 
                                                        |
| 433 | + public function getSchemaType()  | 
                                                        |
| 434 | +	{ | 
                                                        |
| 435 | + return $this instanceof EE_Belongs_To_Relation ? 'object' : 'array';  | 
                                                        |
| 436 | + }  | 
                                                        |
| 437 | +  | 
                                                        |
| 438 | + /**  | 
                                                        |
| 439 | + * This is usually present when the $_schema_type property is 'object'. Any child classes will need to override  | 
                                                        |
| 440 | + * this method and return the properties for the schema.  | 
                                                        |
| 441 | + * The reason this is not a property on the class is because there may be filters set on the values for the property  | 
                                                        |
| 442 | + * that won't be exposed on construct. For example enum type schemas may have the enum values filtered.  | 
                                                        |
| 443 | + *  | 
                                                        |
| 444 | + * @return array  | 
                                                        |
| 445 | + */  | 
                                                        |
| 446 | + public function getSchemaProperties()  | 
                                                        |
| 447 | +	{ | 
                                                        |
| 448 | + return array();  | 
                                                        |
| 449 | + }  | 
                                                        |
| 450 | +  | 
                                                        |
| 451 | + /**  | 
                                                        |
| 452 | + * If a child class has enum values, they should override this method and provide a simple array  | 
                                                        |
| 453 | + * of the enum values.  | 
                                                        |
| 454 | + * The reason this is not a property on the class is because there may be filterable enum values that  | 
                                                        |
| 455 | + * are set on the instantiated object that could be filtered after construct.  | 
                                                        |
| 456 | + *  | 
                                                        |
| 457 | + * @return array  | 
                                                        |
| 458 | + */  | 
                                                        |
| 459 | + public function getSchemaEnum()  | 
                                                        |
| 460 | +	{ | 
                                                        |
| 461 | + return array();  | 
                                                        |
| 462 | + }  | 
                                                        |
| 463 | +  | 
                                                        |
| 464 | + /**  | 
                                                        |
| 465 | + * This returns the value of the $_schema_format property on the object.  | 
                                                        |
| 466 | + *  | 
                                                        |
| 467 | + * @return string  | 
                                                        |
| 468 | + */  | 
                                                        |
| 469 | + public function getSchemaFormat()  | 
                                                        |
| 470 | +	{ | 
                                                        |
| 471 | + return array();  | 
                                                        |
| 472 | + }  | 
                                                        |
| 473 | +  | 
                                                        |
| 474 | + /**  | 
                                                        |
| 475 | + * This returns the value of the $_schema_readonly property on the object.  | 
                                                        |
| 476 | + *  | 
                                                        |
| 477 | + * @return bool  | 
                                                        |
| 478 | + */  | 
                                                        |
| 479 | + public function getSchemaReadonly()  | 
                                                        |
| 480 | +	{ | 
                                                        |
| 481 | + return true;  | 
                                                        |
| 482 | + }  | 
                                                        |
| 483 | +  | 
                                                        |
| 484 | + /**  | 
                                                        |
| 485 | + * This returns elements used to represent this field in the json schema.  | 
                                                        |
| 486 | + *  | 
                                                        |
| 487 | + * @link http://json-schema.org/  | 
                                                        |
| 488 | + * @return array  | 
                                                        |
| 489 | + */  | 
                                                        |
| 490 | + public function getSchema()  | 
                                                        |
| 491 | +	{ | 
                                                        |
| 492 | + $schema = array(  | 
                                                        |
| 493 | + 'description' => $this->getSchemaDescription(),  | 
                                                        |
| 494 | + 'type' => $this->getSchemaType(),  | 
                                                        |
| 495 | + 'relation' => true,  | 
                                                        |
| 496 | + 'relation_type' => get_class($this),  | 
                                                        |
| 497 | + 'readonly' => $this->getSchemaReadonly()  | 
                                                        |
| 498 | + );  | 
                                                        |
| 499 | +  | 
                                                        |
| 500 | +		if ($this instanceof EE_HABTM_Relation) { | 
                                                        |
| 501 | + $schema['joining_model_name'] = $this->get_join_model()->get_this_model_name();  | 
                                                        |
| 502 | + }  | 
                                                        |
| 503 | +  | 
                                                        |
| 504 | +		if ($this->getSchemaType() === 'array') { | 
                                                        |
| 505 | + $schema['items'] = array(  | 
                                                        |
| 506 | + 'type' => 'object'  | 
                                                        |
| 507 | + );  | 
                                                        |
| 508 | + }  | 
                                                        |
| 509 | +  | 
                                                        |
| 510 | + return $schema;  | 
                                                        |
| 511 | + }  | 
                                                        |
| 512 | 512 | }  | 
                                                        
@@ -120,7 +120,7 @@ discard block  | 
                                                    ||
| 120 | 120 | */  | 
                                                        
| 121 | 121 | protected function _get_model($model_name)  | 
                                                        
| 122 | 122 |      { | 
                                                        
| 123 | -        if(empty($model_name)) { | 
                                                        |
| 123 | +        if (empty($model_name)) { | 
                                                        |
| 124 | 124 | throw new RuntimeException(  | 
                                                        
| 125 | 125 | sprintf(  | 
                                                        
| 126 | 126 |                      esc_html__('Invalid Model name provided: "%1$s".', 'event_espresso'), | 
                                                        
@@ -165,7 +165,7 @@ discard block  | 
                                                    ||
| 165 | 165 | $this_table_join_column,  | 
                                                        
| 166 | 166 | $extra_join_sql = ''  | 
                                                        
| 167 | 167 |      ) { | 
                                                        
| 168 | - return " LEFT JOIN " . $other_table . " AS " . $other_table_alias . " ON " . $other_table_alias . "." . $other_table_column . "=" . $this_table_alias . "." . $this_table_join_column . ($extra_join_sql ? " AND $extra_join_sql" : '');  | 
                                                        |
| 168 | + return " LEFT JOIN ".$other_table." AS ".$other_table_alias." ON ".$other_table_alias.".".$other_table_column."=".$this_table_alias.".".$this_table_join_column.($extra_join_sql ? " AND $extra_join_sql" : '');  | 
                                                        |
| 169 | 169 | }  | 
                                                        
| 170 | 170 | |
| 171 | 171 | |
@@ -210,7 +210,7 @@ discard block  | 
                                                    ||
| 210 | 210 | */  | 
                                                        
| 211 | 211 | protected function _disable_default_where_conditions_on_query_param($query_params)  | 
                                                        
| 212 | 212 |      { | 
                                                        
| 213 | -        if (! isset($query_params['default_where_conditions'])) { | 
                                                        |
| 213 | +        if ( ! isset($query_params['default_where_conditions'])) { | 
                                                        |
| 214 | 214 | $query_params['default_where_conditions'] = 'none';  | 
                                                        
| 215 | 215 | }  | 
                                                        
| 216 | 216 | return $query_params;  | 
                                                        
@@ -238,7 +238,7 @@ discard block  | 
                                                    ||
| 238 | 238 | $delete_is_blocked = $this->get_other_model()->delete_is_blocked_by_related_models($related_model_object,  | 
                                                        
| 239 | 239 | $model_object_or_id);  | 
                                                        
| 240 | 240 | /* @var $model_object_or_id EE_Base_Class */  | 
                                                        
| 241 | -            if (! $delete_is_blocked) { | 
                                                        |
| 241 | +            if ( ! $delete_is_blocked) { | 
                                                        |
| 242 | 242 | $this->remove_relation_to($model_object_or_id, $related_model_object);  | 
                                                        
| 243 | 243 | $related_model_object->delete();  | 
                                                        
| 244 | 244 | $deleted_count++;  | 
                                                        
@@ -272,7 +272,7 @@ discard block  | 
                                                    ||
| 272 | 272 |              if ($related_model_object instanceof EE_Soft_Delete_Base_Class) { | 
                                                        
| 273 | 273 | $this->remove_relation_to($model_object_or_id, $related_model_object);  | 
                                                        
| 274 | 274 | $deleted_count++;  | 
                                                        
| 275 | -                if (! $delete_is_blocked) { | 
                                                        |
| 275 | +                if ( ! $delete_is_blocked) { | 
                                                        |
| 276 | 276 | $related_model_object->delete_permanently();  | 
                                                        
| 277 | 277 |                  } else { | 
                                                        
| 278 | 278 | //delete is blocked  | 
                                                        
@@ -281,7 +281,7 @@ discard block  | 
                                                    ||
| 281 | 281 | }  | 
                                                        
| 282 | 282 |              } else { | 
                                                        
| 283 | 283 | //its not a soft-deletable thing anyways. do the normal logic.  | 
                                                        
| 284 | -                if (! $delete_is_blocked) { | 
                                                        |
| 284 | +                if ( ! $delete_is_blocked) { | 
                                                        |
| 285 | 285 | $this->remove_relation_to($model_object_or_id, $related_model_object);  | 
                                                        
| 286 | 286 | $related_model_object->delete();  | 
                                                        
| 287 | 287 | $deleted_count++;  | 
                                                        
@@ -305,7 +305,7 @@ discard block  | 
                                                    ||
| 305 | 305 |          if ($model_object_or_id instanceof EE_Base_Class) { | 
                                                        
| 306 | 306 | $model_object_id = $model_object_or_id->ID();  | 
                                                        
| 307 | 307 | }  | 
                                                        
| 308 | -        if (! $model_object_id) { | 
                                                        |
| 308 | +        if ( ! $model_object_id) { | 
                                                        |
| 309 | 309 |              throw new EE_Error(sprintf(__("Sorry, we cant get the related %s model objects to %s model object before it has an ID. You can solve that by just saving it before trying to get its related model objects", | 
                                                        
| 310 | 310 | "event_espresso"), $this->get_other_model()->get_this_model_name(),  | 
                                                        
| 311 | 311 | $this->get_this_model()->get_this_model_name()));  | 
                                                        
@@ -15,12 +15,12 @@ discard block  | 
                                                    ||
| 15 | 15 | */  | 
                                                        
| 16 | 16 |  class EE_Soft_Delete_Where_Conditions extends EE_Default_Where_Conditions{ | 
                                                        
| 17 | 17 | |
| 18 | - /**  | 
                                                        |
| 19 | - * Gets the where default where conditions for a custom post type model  | 
                                                        |
| 20 | - *  | 
                                                        |
| 21 | - * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions)  | 
                                                        |
| 22 | - * @throws EE_Error  | 
                                                        |
| 23 | - */  | 
                                                        |
| 18 | + /**  | 
                                                        |
| 19 | + * Gets the where default where conditions for a custom post type model  | 
                                                        |
| 20 | + *  | 
                                                        |
| 21 | + * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions)  | 
                                                        |
| 22 | + * @throws EE_Error  | 
                                                        |
| 23 | + */  | 
                                                        |
| 24 | 24 |  	protected function _get_default_where_conditions(){ | 
                                                        
| 25 | 25 | $trashed_field_name = $this->deleted_field_name();  | 
                                                        
| 26 | 26 | return array(  | 
                                                        
@@ -28,8 +28,8 @@ discard block  | 
                                                    ||
| 28 | 28 | );  | 
                                                        
| 29 | 29 | }  | 
                                                        
| 30 | 30 | /**  | 
                                                        
| 31 | - * Searches for field on the model of type 'deleted_flag',  | 
                                                        |
| 32 | - * and returns its name if found,  | 
                                                        |
| 31 | + * Searches for field on the model of type 'deleted_flag',  | 
                                                        |
| 32 | + * and returns its name if found,  | 
                                                        |
| 33 | 33 | *  | 
                                                        
| 34 | 34 | * @return string  | 
                                                        
| 35 | 35 | * @throws EE_Error  | 
                                                        
@@ -39,15 +39,15 @@ discard block  | 
                                                    ||
| 39 | 39 |  		if($field){ | 
                                                        
| 40 | 40 | return $field->get_name();  | 
                                                        
| 41 | 41 | }  | 
                                                        
| 42 | - throw new EE_Error(  | 
                                                        |
| 43 | - sprintf(  | 
                                                        |
| 44 | - __(  | 
                                                        |
| 45 | - 'We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?',  | 
                                                        |
| 46 | - 'event_espresso'  | 
                                                        |
| 47 | - ),  | 
                                                        |
| 48 | - get_class($this),  | 
                                                        |
| 49 | - get_class($this)  | 
                                                        |
| 50 | - )  | 
                                                        |
| 51 | - );  | 
                                                        |
| 52 | - }  | 
                                                        |
| 42 | + throw new EE_Error(  | 
                                                        |
| 43 | + sprintf(  | 
                                                        |
| 44 | + __(  | 
                                                        |
| 45 | + 'We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?',  | 
                                                        |
| 46 | + 'event_espresso'  | 
                                                        |
| 47 | + ),  | 
                                                        |
| 48 | + get_class($this),  | 
                                                        |
| 49 | + get_class($this)  | 
                                                        |
| 50 | + )  | 
                                                        |
| 51 | + );  | 
                                                        |
| 52 | + }  | 
                                                        |
| 53 | 53 | }  | 
                                                        
@@ -1,6 +1,6 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { | 
                                                        |
| 3 | - exit( 'No direct script access allowed' );  | 
                                                        |
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { | 
                                                        |
| 3 | +	exit('No direct script access allowed'); | 
                                                        |
| 4 | 4 | }  | 
                                                        
| 5 | 5 | /**  | 
                                                        
| 6 | 6 | * Class EE_Soft_Delete_Where_Conditions  | 
                                                        
@@ -13,7 +13,7 @@ discard block  | 
                                                    ||
| 13 | 13 | * @author Mike Nelson  | 
                                                        
| 14 | 14 | * @since 4.6.0  | 
                                                        
| 15 | 15 | */  | 
                                                        
| 16 | -class EE_Soft_Delete_Where_Conditions extends EE_Default_Where_Conditions{ | 
                                                        |
| 16 | +class EE_Soft_Delete_Where_Conditions extends EE_Default_Where_Conditions { | 
                                                        |
| 17 | 17 | |
| 18 | 18 | /**  | 
                                                        
| 19 | 19 | * Gets the where default where conditions for a custom post type model  | 
                                                        
@@ -21,7 +21,7 @@ discard block  | 
                                                    ||
| 21 | 21 | * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions)  | 
                                                        
| 22 | 22 | * @throws EE_Error  | 
                                                        
| 23 | 23 | */  | 
                                                        
| 24 | -	protected function _get_default_where_conditions(){ | 
                                                        |
| 24 | +	protected function _get_default_where_conditions() { | 
                                                        |
| 25 | 25 | $trashed_field_name = $this->deleted_field_name();  | 
                                                        
| 26 | 26 | return array(  | 
                                                        
| 27 | 27 | $trashed_field_name => false  | 
                                                        
@@ -34,9 +34,9 @@ discard block  | 
                                                    ||
| 34 | 34 | * @return string  | 
                                                        
| 35 | 35 | * @throws EE_Error  | 
                                                        
| 36 | 36 | */  | 
                                                        
| 37 | -	private function deleted_field_name(){ | 
                                                        |
| 37 | +	private function deleted_field_name() { | 
                                                        |
| 38 | 38 |  		$field = $this->_model->get_a_field_of_type('EE_Trashed_Flag_Field'); | 
                                                        
| 39 | -		if($field){ | 
                                                        |
| 39 | +		if ($field) { | 
                                                        |
| 40 | 40 | return $field->get_name();  | 
                                                        
| 41 | 41 | }  | 
                                                        
| 42 | 42 | throw new EE_Error(  |