/**
  * load_required_files
  */
 protected function set_autoloaders_for_required_files()
 {
     // load interfaces
     espresso_load_required('EEI_Interfaces', EE_CORE . 'interfaces' . DS . 'EEI_Interfaces.php');
     // load helpers
     EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS);
     // load request stack
     EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack' . DS);
     // load middleware
     EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware' . DS);
 }
 /**
  * @access    public
  */
 public function __construct()
 {
     static $initialized = false;
     if (!$initialized) {
         // instantiate PSR4 autoloader
         espresso_load_required('Psr4Autoloader', EE_CORE . 'Psr4Autoloader.php');
         EE_Psr4AutoloaderInit::$psr4_loader = new \EventEspresso\Core\Psr4Autoloader();
         // register the autoloader
         EE_Psr4AutoloaderInit::$psr4_loader->register();
         // register the base directories for the namespace prefix
         EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspresso', EE_PLUGIN_DIR_PATH);
         EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoBatchRequest', EE_LIBRARIES . 'batch');
         $initialized = true;
     }
 }
 /**
  *    handle
  *    sets hooks for running rest of system
  *    provides "AHEE__EE_System__construct__complete" hook for EE Addons to use as their starting point
  *    starting EE Addons from any other point may lead to problems
  *
  * @access 	public
  * @param 	EE_Request 	$request
  * @param 	EE_Response $response
  * @return 	EE_Response
  */
 public function handle_request(EE_Request $request, EE_Response $response)
 {
     $this->request = $request;
     $this->response = $response;
     // central repository for classes
     $this->_load_registry();
     // workarounds for PHP < 5.3
     $this->_load_class_tools();
     // PSR4 Autoloaders
     EE_Registry::instance()->load_core('EE_Psr4AutoloaderInit');
     // deprecated functions
     espresso_load_required('EE_Deprecated', EE_CORE . 'EE_Deprecated.core.php');
     // load interfaces
     espresso_load_required('EEI_Payment_Method_Interfaces', EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php');
     //// WP cron jobs
     EE_Registry::instance()->load_core('Cron_Tasks');
     EE_Registry::instance()->load_core('EE_System');
     return $this->response;
 }
 /**
  *    handle
  *    sets hooks for running rest of system
  *    provides "AHEE__EE_System__construct__complete" hook for EE Addons to use as their starting point
  *    starting EE Addons from any other point may lead to problems
  *
  * @access 	public
  * @param 	EE_Request 	$request
  * @param 	EE_Response $response
  * @return 	EE_Response
  */
 public function handle_request(EE_Request $request, EE_Response $response)
 {
     $this->request = $request;
     $this->response = $response;
     // info about how to load classes required by other classes
     $this->dependency_map = $this->_load_dependency_map();
     // central repository for classes
     $this->registry = $this->_load_registry();
     do_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading');
     // PSR4 Autoloaders
     $this->registry->load_core('EE_Psr4AutoloaderInit');
     // workarounds for PHP < 5.3
     $this->_load_class_tools();
     // load interfaces
     espresso_load_required('EEI_Payment_Method_Interfaces', EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php');
     // deprecated functions
     espresso_load_required('EE_Deprecated', EE_CORE . 'EE_Deprecated.core.php');
     // WP cron jobs
     $this->registry->load_core('Cron_Tasks');
     $this->registry->load_core('EE_Request_Handler');
     $this->registry->load_core('EE_System');
     return $this->response;
 }
Example #5
0
/**
 * 	espresso_plugin_deactivation
 */
function espresso_plugin_deactivation()
{
    espresso_load_required('EEH_Activation', EE_HELPERS . 'EEH_Activation.helper.php');
    EEH_Activation::plugin_deactivation();
}
    function espresso_load_required($classname, $full_path_to_file)
    {
        static $error_handling_loaded = false;
        if (!$error_handling_loaded) {
            espresso_load_error_handling();
            $error_handling_loaded = true;
        }
        if (is_readable($full_path_to_file)) {
            require_once $full_path_to_file;
        } else {
            throw new EE_Error(sprintf(__('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'), $classname));
        }
    }
    espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php');
    espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php');
    espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php');
    new EE_Bootstrap();
}
if (!function_exists('espresso_deactivate_plugin')) {
    /**
     *    deactivate_plugin
     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
     *
     * @access public
     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
     * @return    void
     */
    function espresso_deactivate_plugin($plugin_basename = '')
    {
        if (!function_exists('deactivate_plugins')) {
            require_once ABSPATH . 'wp-admin/includes/plugin.php';
 /**
  * 	captures plugin activation errors for debugging
  *
  * 	@return void
  */
 public static function ee_plugin_activation_errors()
 {
     if (WP_DEBUG) {
         $activation_errors = ob_get_contents();
         if (!empty($activation_errors)) {
             $activation_errors = date('Y-m-d H:i:s') . "\n" . $activation_errors;
         }
         espresso_load_required('EEH_File', EE_HELPERS . 'EEH_File.helper.php');
         if (class_exists('EEH_File')) {
             try {
                 EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html');
                 EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html', $activation_errors);
             } catch (EE_Error $e) {
                 EE_Error::add_error(sprintf(__('The Event Espresso activation errors file could not be setup because: %s', 'event_espresso'), $e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
             }
         } else {
             // old school attempt
             file_put_contents(EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html', $activation_errors);
         }
         $activation_errors = get_option('ee_plugin_activation_errors', '') . $activation_errors;
         update_option('ee_plugin_activation_errors', $activation_errors);
     }
 }
/**
 * 	espresso_plugin_deactivation
 */
function espresso_plugin_deactivation()
{
    if (EE_System::instance()->minimum_php_version_required()) {
        espresso_load_required('EEH_Activation', EE_HELPERS . 'EEH_Activation.helper.php');
        EEH_Activation::plugin_deactivation();
    }
}