/**
  * process_request_stack
  *
  * @access 	protected
  * @param 	EE_Request  $request
  * @param 	EE_Response $response
  * @return 	EE_Response
  */
 protected function process_request_stack(EE_Request $request, EE_Response $response)
 {
     $this->_request = $request;
     $this->_response = $response;
     if (!$this->_response->request_terminated()) {
         $this->_response = $this->request_stack->handle_request($this->_request, $this->_response);
     } else {
         espresso_deactivate_plugin(EE_PLUGIN_BASENAME);
     }
     return $this->_response;
 }
    /**
     *    espresso_duplicate_plugin_error
     *    displays if more than one version of EE is activated at the same time
     */
    function espresso_duplicate_plugin_error()
    {
        ?>
		<div class="error">
			<p><?php 
        _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso');
        ?>
</p>
		</div>
		<?php 
        espresso_deactivate_plugin(plugin_basename(__FILE__));
    }
 /**
  * Using the information gathered in EE_System::_incompatible_addon_error,
  * deactivates any addons considered incompatible with the current version of EE
  */
 private function _deactivate_incompatible_addons()
 {
     $incompatible_addons = get_option('ee_incompatible_addons', array());
     if (!empty($incompatible_addons)) {
         $active_plugins = get_option('active_plugins', array());
         foreach ($active_plugins as $active_plugin) {
             foreach ($incompatible_addons as $incompatible_addon) {
                 if (strpos($active_plugin, $incompatible_addon) !== FALSE) {
                     unset($_GET['activate']);
                     espresso_deactivate_plugin($active_plugin);
                 }
             }
         }
     }
 }
 /**
  * handle_response
  * called after the request stack has been fully processed
  * if any of the middleware apps has requested the plugin be deactivated, then we do that now
  *
  * @access    public
  * @param \EE_Request $request
  * @param \EE_Response $response
  */
 public function handle_response(EE_Request $request, EE_Response $response)
 {
     //\EEH_Debug_Tools::printr( __FUNCTION__, __CLASS__, __FILE__, __LINE__, 2 );
     //EEH_Debug_Tools::printr( $request, '$request', __FILE__, __LINE__ );
     //EEH_Debug_Tools::printr( $response, '$response', __FILE__, __LINE__ );
     //die();
     if ($response->plugin_deactivated()) {
         espresso_deactivate_plugin(EE_PLUGIN_BASENAME);
     }
 }