Exemplo n.º 1
0
 /**
  * class constructor
  *
  * @throws \EE_Error
  */
 protected function __construct()
 {
     // define global EE_Admin constants
     $this->_define_all_constants();
     // set autoloaders for our admin page classes based on included path information
     EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN);
     // admin hooks
     add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2);
     // load EE_Request_Handler early
     add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request'));
     add_action('AHEE__EE_System__initialize_last', array($this, 'init'));
     // post shortcode tracking
     add_action('AHEE__EE_System__initialize_last', array('EventEspresso\\core\\admin\\PostShortcodeTracking', 'set_hooks_admin'));
     add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2);
     add_action('wp_loaded', array($this, 'wp_loaded'), 100);
     add_action('admin_init', array($this, 'admin_init'), 100);
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20);
     add_action('admin_notices', array($this, 'display_admin_notices'), 10);
     add_action('network_admin_notices', array($this, 'display_admin_notices'), 10);
     add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2);
     add_filter('admin_footer_text', array($this, 'espresso_admin_footer'));
     //reset Environment config (we only do this on admin page loads);
     EE_Registry::instance()->CFG->environment->recheck_values();
     do_action('AHEE__EE_Admin__loaded');
 }
 /**
  *    initialize_template_parts
  *
  * @access    public
  * @param \EE_Events_Archive_Config $config
  * @return \EE_Template_Part_Manager
  */
 public function initialize_template_parts(EE_Events_Archive_Config $config = null)
 {
     $config = $config instanceof EE_Events_Archive_Config ? $config : $this->config();
     EEH_Autoloader::instance()->register_template_part_autoloaders();
     $template_parts = new EE_Template_Part_Manager();
     $template_parts->add_template_part('tickets', __('Ticket Selector', 'event_espresso'), 'content-espresso_events-tickets.php', $config->display_order_tickets);
     $template_parts->add_template_part('datetimes', __('Dates and Times', 'event_espresso'), 'content-espresso_events-datetimes.php', $config->display_order_datetimes);
     $template_parts->add_template_part('event', __('Event Description', 'event_espresso'), 'content-espresso_events-details.php', $config->display_order_event);
     $template_parts->add_template_part('venue', __('Venue Information', 'event_espresso'), 'content-espresso_events-venues.php', $config->display_order_venue);
     do_action('AHEE__EED_Event_Archive__initialize_template_parts', $template_parts);
     return $template_parts;
 }
Exemplo n.º 3
0
 /**
  * load_espresso_addons
  *
  * allow addons to load first so that they can set hooks for running DMS's, etc
  * this is hooked into both:
  * 	'AHEE__EE_Bootstrap__load_core_configuration'
  * 		which runs during the WP 'plugins_loaded' action at priority 5
  * 	and the WP 'activate_plugin' hookpoint
  *
  * @access public
  * @return void
  */
 public function load_espresso_addons()
 {
     // set autoloaders for all of the classes implementing EEI_Plugin_API
     // which provide helpers for EE plugin authors to more easily register certain components with EE.
     EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES . 'plugin_api');
     //load and setup EE_Capabilities
     $this->registry->load_core('Capabilities');
     //caps need to be initialized on every request so that capability maps are set.
     //@see https://events.codebasehq.com/projects/event-espresso/tickets/8674
     $this->registry->CAP->init_caps();
     do_action('AHEE__EE_System__load_espresso_addons');
     //if the WP API basic auth plugin isn't already loaded, load it now.
     //We want it for mobile apps. Just include the entire plugin
     //also, don't load the basic auth when a plugin is getting activated, because
     //it could be the basic auth plugin, and it doesn't check if its methods are already defined
     //and causes a fatal error
     if (!function_exists('json_basic_auth_handler') && !function_exists('json_basic_auth_error') && !(isset($_GET['action']) && in_array($_GET['action'], array('activate', 'activate-selected'))) && !(isset($_GET['activate']) && $_GET['activate'] === 'true')) {
         include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php';
     }
 }
 /**
  * load_espresso_addons
  *
  * allow addons to load first so that they can set hooks for running DMS's, etc
  *
  * @access public
  * @return void
  */
 public function load_espresso_addons()
 {
     // set autoloaders for all of the classes implementing EEI_Plugin_API
     // which provide helpers for EE plugin authors to more easily register certain components with EE.
     EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES . 'plugin_api');
     //load and setup EE_Capabilities
     EE_Registry::instance()->load_core('Capabilities');
     do_action('AHEE__EE_System__load_espresso_addons');
 }
 /**
  *    Method for registering new EE_Addons.
  * Should be called AFTER AHEE__EE_System__load_espresso_addons but BEFORE AHEE__EE_System___detect_if_activation_or_upgrade__begin in order to register all its components.
  * However, it may also be called after the 'activate_plugin' action (when an addon is activated),
  * because an activating addon won't be loaded by WP until after AHEE__EE_System__load_espresso_addons has fired.
  * If its called after 'activate_plugin', it registers the addon still, but its components are not registered
  * (they shouldn't be needed anyways, because it's just an activation request and they won't have a chance to do anything anyways). Instead, it just sets the newly-activated addon's activation indicator wp option and returns
  * (so that we can detect that the addon has activated on the subsequent request)
  *
  * @since    4.3.0
  * @param string $addon_name 		the EE_Addon's name. Required.
  * @param  array $setup_args { 			An array of arguments provided for registering the message type.
  * @type  string $class_name the addon's main file name. If left blank, generated from the addon name, changes something like "calendar" to "EE_Calendar"
  *			@type string $min_core_version  the minimum version of EE Core that the addon will work with. eg "4.8.1.rc.084"
  *			@type string $version the "software" version for the addon. eg "1.0.0.p" for a first stable release, or "1.0.0.rc.043" for a version in progress
  *			@type string $main_file_path the full server path to the main file loaded directly by WP
  *          @type string $admin_path 	full server path to the folder where the addon\'s admin files reside
  *			@type string $admin_callback a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page
  *			@type string $config_section the section name for this addon's configuration settings section (defaults to "addons")
  *			@type string $config_class the class name for this addon's configuration settings object
  *			@type string $config_name the class name for this addon's configuration settings object
  * 			@type string $autoloader_paths an array of class names and the full server paths to those files. Required.
  *			@type string $autoloader_folders  an array of  "full server paths" for any folders containing classes that might be invoked by the addon
  * 			@type string $dms_paths 				an array of full server paths to folders that contain data migration scripts. Required.
  * 			@type string $module_paths 	an array of full server paths to any EED_Modules used by the addon
  * 			@type string $shortcode_paths 	an array of full server paths to folders that contain EES_Shortcodes
  * 			@type string $widget_paths 					an array of full server paths to folders that contain WP_Widgets
  *			@type string $pue_options
  * 			@type array $capabilities  {
  * 			      	an array indexed by role name (i.e. administrator,author ) and the values are an array of caps to add to the role.
  * 			      	'administrator' => array('read_addon', 'edit_addon' etc.).
  * 	         		}
  * 	        @type EE_Meta_Capability_Map[] $capability_maps an array of EE_Meta_Capability_Map object for any addons that need to register any special meta mapped capabilities.  Should be indexed where the key is the EE_Meta_Capability_Map class name and the values are the arguments sent to the class.
  *			@type array $model_paths array of folders containing DB models @see EE_Register_Model
  *			@type array $class_paths array of folders containing DB classes @see EE_Register_Model
  *			@type array $model_extension_paths array of folders containing DB model extensions @see EE_Register_Model_Extension
  *			@type array $class_extension_paths array of folders containing DB class extensions @see EE_Register_Model_Extension
  * 			@type array message_types {
  *       		 An array of message types with the key as the message type name and the values as below:
  *        		@type string $mtfilename The filename of the message type being registered.  This will be the main
  *                                       EE_{Messagetype_Name}_message_type class. (eg. EE_Declined_Registration_message_type.class.php). Required.
  *               @type array $autoloadpaths An array of paths to add to the messages autoloader for the new message type. Required.
  *               @type array $messengers_to_activate_with An array of messengers that this message
  *                           type should activate with. Each value in the array should match the name property of a EE_messenger. Optional.
  *               @type array $messengers_to_validate_with An array of messengers that this message
  *                          type should validate with. Each value in the array should match the name property of an EE_messenger. Optional.
  *       	}
  *			@type array $custom_post_types
  *			@type array $custom_taxonomies
  *			@type array $payment_method_paths each element is the folder containing the EE_PMT_Base child class
  *				(eg, 'public_html/wp-content/plugins/my_plugin/Payomatic/' which contains the files
  *				EE_PMT_Payomatic.pm.php)
  *			@type array $default_terms
  * 	}
  *
  * @throws EE_Error
  * @return void
  */
 public static function register($addon_name = '', $setup_args = array())
 {
     // required fields MUST be present, so let's make sure they are.
     if (empty($addon_name) || !is_array($setup_args)) {
         throw new EE_Error(__('In order to register an EE_Addon with EE_Register_Addon::register(), you must include the "addon_name" (the name of the addon), and an array of arguments.', 'event_espresso'));
     }
     if (!isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) {
         throw new EE_Error(sprintf(__('When registering an addon, you didn\'t provide the "main_file_path", which is the full path to the main file loaded directly by Wordpress. You only provided %s', 'event_espresso'), implode(",", array_keys($setup_args))));
     }
     // check that addon has not already been registered with that name
     if (isset(self::$_settings[$addon_name]) && !did_action('activate_plugin')) {
         throw new EE_Error(sprintf(__('An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.', 'event_espresso'), $addon_name));
     }
     // no class name for addon?
     if (empty($setup_args['class_name'])) {
         // generate one by first separating name with spaces
         $class_name = str_replace(array('-', '_'), ' ', trim($addon_name));
         //capitalize, then replace spaces with underscores
         $class_name = str_replace(' ', '_', ucwords($class_name));
     } else {
         $class_name = $setup_args['class_name'];
     }
     $class_name = strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_' . $class_name;
     //setup $_settings array from incoming values.
     $addon_settings = array('class_name' => $class_name, 'plugin_slug' => isset($setup_args['plugin_slug']) ? (string) $setup_args['plugin_slug'] : '', 'plugin_action_slug' => isset($setup_args['plugin_action_slug']) ? (string) $setup_args['plugin_action_slug'] : '', 'version' => isset($setup_args['version']) ? (string) $setup_args['version'] : '', 'min_core_version' => isset($setup_args['min_core_version']) ? (string) $setup_args['min_core_version'] : '', 'main_file_path' => isset($setup_args['main_file_path']) ? (string) $setup_args['main_file_path'] : '', 'admin_path' => isset($setup_args['admin_path']) ? (string) $setup_args['admin_path'] : '', 'admin_callback' => isset($setup_args['admin_callback']) ? (string) $setup_args['admin_callback'] : '', 'config_section' => isset($setup_args['config_section']) ? (string) $setup_args['config_section'] : 'addons', 'config_class' => isset($setup_args['config_class']) ? (string) $setup_args['config_class'] : '', 'config_name' => isset($setup_args['config_name']) ? (string) $setup_args['config_name'] : '', 'autoloader_paths' => isset($setup_args['autoloader_paths']) ? (array) $setup_args['autoloader_paths'] : array(), 'autoloader_folders' => isset($setup_args['autoloader_folders']) ? (array) $setup_args['autoloader_folders'] : array(), 'dms_paths' => isset($setup_args['dms_paths']) ? (array) $setup_args['dms_paths'] : array(), 'module_paths' => isset($setup_args['module_paths']) ? (array) $setup_args['module_paths'] : array(), 'shortcode_paths' => isset($setup_args['shortcode_paths']) ? (array) $setup_args['shortcode_paths'] : array(), 'widget_paths' => isset($setup_args['widget_paths']) ? (array) $setup_args['widget_paths'] : array(), 'pue_options' => isset($setup_args['pue_options']) ? (array) $setup_args['pue_options'] : array(), 'message_types' => isset($setup_args['message_types']) ? (array) $setup_args['message_types'] : array(), 'capabilities' => isset($setup_args['capabilities']) ? (array) $setup_args['capabilities'] : array(), 'capability_maps' => isset($setup_args['capability_maps']) ? (array) $setup_args['capability_maps'] : array(), 'model_paths' => isset($setup_args['model_paths']) ? (array) $setup_args['model_paths'] : array(), 'class_paths' => isset($setup_args['class_paths']) ? (array) $setup_args['class_paths'] : array(), 'model_extension_paths' => isset($setup_args['model_extension_paths']) ? (array) $setup_args['model_extension_paths'] : array(), 'class_extension_paths' => isset($setup_args['class_extension_paths']) ? (array) $setup_args['class_extension_paths'] : array(), 'custom_post_types' => isset($setup_args['custom_post_types']) ? (array) $setup_args['custom_post_types'] : array(), 'custom_taxonomies' => isset($setup_args['custom_taxonomies']) ? (array) $setup_args['custom_taxonomies'] : array(), 'payment_method_paths' => isset($setup_args['payment_method_paths']) ? (array) $setup_args['payment_method_paths'] : array(), 'default_terms' => isset($setup_args['default_terms']) ? (array) $setup_args['default_terms'] : array(), 'plugins_page_row' => isset($setup_args['plugins_page_row']) ? $setup_args['plugins_page_row'] : '');
     // if plugin_action_slug is NOT set, but an admin page path IS set, then let's just use the plugin_slug since that will be used for linking to the admin page
     $addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug']) && !empty($addon_settings['admin_path']) ? $addon_settings['plugin_slug'] : $addon_settings['plugin_action_slug'];
     // full server path to main file (file loaded directly by WP)
     $addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']);
     //check whether this addon version is compatible with EE core
     if (isset(EE_Register_Addon::$_incompatible_addons[$addon_name]) && !self::_meets_min_core_version_requirement(EE_Register_Addon::$_incompatible_addons[$addon_name], $addon_settings['version'])) {
         $incompatibility_message = sprintf(__('The Event Espresso "%1$s" addon was deactivated because it is incompatible with this version of core.%2$s Only version %3$s or higher of "%1$s" can run with this version of core. This can happen when attempting to run beta versions or release candidates with older versions of core, or running old versions of addons with a newer version of core.%2$sPlease upgrade Event Espresso Core and the "%1$s" addon, then re-attempt activating it.', 'event_espresso'), $addon_name, '<br />', EE_Register_Addon::$_incompatible_addons[$addon_name]);
     } else {
         if (!self::_meets_min_core_version_requirement($setup_args['min_core_version'], espresso_version())) {
             $incompatibility_message = sprintf(__('The Event Espresso "%1$s" addon could not be activated because it requires Event Espresso Core version "%2$s" or higher in order to run.%4$sYour version of Event Espresso Core is currently at "%3$s". Please upgrade Event Espresso Core first and then re-attempt activating "%1$s".', 'event_espresso'), $addon_name, self::_effective_version($setup_args['min_core_version']), self::_effective_version(espresso_version()), '<br />');
         } else {
             $incompatibility_message = '';
         }
     }
     if (!empty($incompatibility_message)) {
         //remove 'activate' from the REQUEST so WP doesn't erroneously tell the user the
         //plugin activated fine when it didn't
         if (isset($_GET['activate'])) {
             unset($_GET['activate']);
         }
         if (isset($_REQUEST['activate'])) {
             unset($_REQUEST['activate']);
         }
         //and show an error message indicating the plugin didn't activate properly
         EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__);
         if (current_user_can('activate_plugins')) {
             require_once ABSPATH . 'wp-admin/includes/plugin.php';
             deactivate_plugins(plugin_basename($addon_settings['main_file_path']), TRUE);
         }
         return;
     }
     //this is an activation request
     if (did_action('activate_plugin')) {
         //to find if THIS is the addon that was activated,
         //just check if we have already registered it or not
         //(as the newly-activated addon wasn't around the first time addons were registered)
         if (!isset(self::$_settings[$addon_name])) {
             self::$_settings[$addon_name] = $addon_settings;
             $addon = self::_load_and_init_addon_class($addon_name);
             $addon->set_activation_indicator_option();
             //dont bother setting up the rest of the addon.
             //we know it was just activated and the request will end soon
         }
         return;
     } else {
         // make sure this was called in the right place!
         if (!did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin')) {
             EE_Error::doing_it_wrong(__METHOD__, sprintf(__('An attempt to register an EE_Addon named "%s" has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register addons.', 'event_espresso'), $addon_name), '4.3.0');
         }
         self::$_settings[$addon_name] = $addon_settings;
     }
     // we need cars
     if (!empty(self::$_settings[$addon_name]['autoloader_paths'])) {
         // setup autoloader for single file
         EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']);
     }
     // setup autoloaders for folders
     if (!empty(self::$_settings[$addon_name]['autoloader_folders'])) {
         foreach (self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) {
             EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder);
         }
     }
     // register new models
     if (!empty(self::$_settings[$addon_name]['model_paths']) || !empty(self::$_settings[$addon_name]['class_paths'])) {
         EE_Register_Model::register($addon_name, array('model_paths' => self::$_settings[$addon_name]['model_paths'], 'class_paths' => self::$_settings[$addon_name]['class_paths']));
     }
     // register model extensions
     if (!empty(self::$_settings[$addon_name]['model_extension_paths']) || !empty(self::$_settings[$addon_name]['class_extension_paths'])) {
         EE_Register_Model_Extensions::register($addon_name, array('model_extension_paths' => self::$_settings[$addon_name]['model_extension_paths'], 'class_extension_paths' => self::$_settings[$addon_name]['class_extension_paths']));
     }
     // setup DMS
     if (!empty(self::$_settings[$addon_name]['dms_paths'])) {
         EE_Register_Data_Migration_Scripts::register($addon_name, array('dms_paths' => self::$_settings[$addon_name]['dms_paths']));
     }
     // if config_class is present let's register config.
     if (!empty(self::$_settings[$addon_name]['config_class'])) {
         EE_Register_Config::register(self::$_settings[$addon_name]['config_class'], array('config_section' => self::$_settings[$addon_name]['config_section'], 'config_name' => self::$_settings[$addon_name]['config_name']));
     }
     // register admin page
     if (!empty(self::$_settings[$addon_name]['admin_path'])) {
         EE_Register_Admin_Page::register($addon_name, array('page_path' => self::$_settings[$addon_name]['admin_path']));
     }
     // add to list of modules to be registered
     if (!empty(self::$_settings[$addon_name]['module_paths'])) {
         EE_Register_Module::register($addon_name, array('module_paths' => self::$_settings[$addon_name]['module_paths']));
     }
     // add to list of shortcodes to be registered
     if (!empty(self::$_settings[$addon_name]['shortcode_paths'])) {
         EE_Register_Shortcode::register($addon_name, array('shortcode_paths' => self::$_settings[$addon_name]['shortcode_paths']));
     }
     // add to list of widgets to be registered
     if (!empty(self::$_settings[$addon_name]['widget_paths'])) {
         EE_Register_Widget::register($addon_name, array('widget_paths' => self::$_settings[$addon_name]['widget_paths']));
     }
     //register capability related stuff.
     if (!empty(self::$_settings[$addon_name]['capabilities'])) {
         EE_Register_Capabilities::register($addon_name, array('capabilities' => self::$_settings[$addon_name]['capabilities'], 'capability_maps' => self::$_settings[$addon_name]['capability_maps']));
     }
     //any message type to register?
     if (!empty(self::$_settings[$addon_name]['message_types'])) {
         add_action('EE_Brewing_Regular___messages_caf', array('EE_Register_Addon', 'register_message_types'));
     }
     // if plugin update engine is being used for auto-updates (not needed if PUE is not being used)
     if (!empty($setup_args['pue_options'])) {
         self::$_settings[$addon_name]['pue_options'] = array('pue_plugin_slug' => isset($setup_args['pue_options']['pue_plugin_slug']) ? (string) $setup_args['pue_options']['pue_plugin_slug'] : 'espresso_' . strtolower($class_name), 'plugin_basename' => isset($setup_args['pue_options']['plugin_basename']) ? (string) $setup_args['pue_options']['plugin_basename'] : plugin_basename(self::$_settings[$addon_name]['main_file_path']), 'checkPeriod' => isset($setup_args['pue_options']['checkPeriod']) ? (string) $setup_args['pue_options']['checkPeriod'] : '24', 'use_wp_update' => isset($setup_args['pue_options']['use_wp_update']) ? (string) $setup_args['pue_options']['use_wp_update'] : FALSE);
         add_action('AHEE__EE_System__brew_espresso__after_pue_init', array('EE_Register_Addon', 'load_pue_update'));
     }
     //any custom post type/ custom capabilities or default terms to register
     if (!empty(self::$_settings[$addon_name]['custom_post_types']) || !empty(self::$_settings[$addon_name]['custom_taxonomies'])) {
         EE_Register_CPT::register($addon_name, array('cpts' => self::$_settings[$addon_name]['custom_post_types'], 'cts' => self::$_settings[$addon_name]['custom_taxonomies'], 'default_terms' => self::$_settings[$addon_name]['default_terms']));
     }
     if (!empty(self::$_settings[$addon_name]['payment_method_paths'])) {
         EE_Register_Payment_Method::register($addon_name, array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths']));
     }
     // load and instantiate main addon class
     $addon = self::_load_and_init_addon_class($addon_name);
     // call any additional admin_callback functions during load_admin_controller hook
     if (!empty(self::$_settings[$addon_name]['admin_callback'])) {
         add_action('AHEE__EE_System__load_controllers__load_admin_controllers', array($addon, self::$_settings[$addon_name]['admin_callback']));
     }
 }
 /**
  * This method is the "workhorse" for detecting and setting up caffeinated functionality.
  *
  * In this method there are three checks being done:
  * 1. Do we have any NEW admin page sets.  If we do, lets add them into the menu setup (via the $installed_refs array) etc.  (new page sets are found in caffeinated/new/{page})
  * 2. Do we have any EXTENDED page sets.  Basically an extended EE_Admin Page extends the core {child}_Admin_Page class.  eg. would be caffeinated/extend/events/Extend_Events_Admin_Page.core.php and in there would be a class: Extend_Events_Admin_Page extends Events_Admin_Page.
  * 3. Do we have any files just for setting up hooks into other core pages.  The files can be any name in "caffeinated/hooks" EXCEPT they need a ".class.php" extension and the file name must correspond with the classname inside.  These classes are instantiated really early so that any hooks in them are run before the corresponding apply_filters/do_actions that are found in any future loaded EE_Admin pages (INCLUDING caffeinated admin_pages)
  *
  *
  *
  * @param array $installed_refs the original installed_refs array that may contain our NEW EE_Admin_Pages to be loaded.
  * @return array
  */
 private function _set_caffeinated($installed_refs)
 {
     //first let's check if there IS a caffeinated folder. If there is not then lets get out.
     if (!is_dir(EE_PLUGIN_DIR_PATH . 'caffeinated' . DS . 'admin') || defined('EE_DECAF') && EE_DECAF) {
         return $installed_refs;
     }
     $this->_define_caffeinated_constants();
     $exclude = array('tickets');
     //okay let's setup an "New" pages first (we'll return installed refs later)
     $new_admin_screens = glob(EE_CORE_CAF_ADMIN . 'new/*', GLOB_ONLYDIR);
     if ($new_admin_screens) {
         foreach ($new_admin_screens as $admin_screen) {
             // files and anything in the exclude array need not apply
             if (is_dir($admin_screen) && !in_array(basename($admin_screen), $exclude)) {
                 // these folders represent the different NEW EE admin pages
                 $installed_refs[basename($admin_screen)] = $admin_screen;
                 // set autoloaders for our admin page classes based on included path information
                 EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($admin_screen);
                 //					$this->_caf_autoloader[] = array(
                 //						'dir' => 'new',
                 //						'folder' => basename( $admin_screen )
                 //					);
             }
         }
     }
     //let's see if there are any EXTENDS to setup in the $_caffeinated_extends array (that will be used later for hooking into the _initialize_admin_age in the related core_init admin page)
     $extends = glob(EE_CORE_CAF_ADMIN . 'extend/*', GLOB_ONLYDIR);
     if ($extends) {
         foreach ($extends as $extend) {
             if (is_dir($extend)) {
                 $extend_ref = basename($extend);
                 //now let's make sure there is a file that matches the expected format
                 $filename = str_replace(' ', '_', ucwords(str_replace('_', ' ', $extend_ref)));
                 $filename = 'Extend_' . $filename . '_Admin_Page';
                 $this->_caffeinated_extends[$extend_ref]['path'] = str_replace(array('\\', '/'), DS, EE_CORE_CAF_ADMIN . 'extend' . DS . $extend_ref . DS . $filename . '.core.php');
                 $this->_caffeinated_extends[$extend_ref]['admin_page'] = $filename;
                 // set autoloaders for our admin page classes based on included path information
                 EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($extend);
                 //					$this->_caf_autoloader[] = array(
                 //						'dir' => 'extend',
                 //						'folder' => $extend_ref
                 //					);
             }
         }
     }
     //let's see if there are any HOOK files and instantiate them if there are (so that hooks are loaded early!).
     $ee_admin_hooks = array();
     $hooks = glob(EE_CORE_CAF_ADMIN . 'hooks/*.class.php');
     if ($hooks) {
         foreach ($hooks as $hook) {
             if (is_readable($hook)) {
                 require_once $hook;
                 $classname = str_replace(EE_CORE_CAF_ADMIN . 'hooks/', '', $hook);
                 $classname = str_replace('.class.php', '', $classname);
                 if (class_exists($classname)) {
                     $a = new ReflectionClass($classname);
                     $ee_admin_hooks[] = $a->newInstance();
                 }
             }
         }
     }
     /**/
     $ee_admin_hooks = apply_filters('FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks);
     return $installed_refs;
 }
 /**
  * load_autoloader
  */
 protected function load_autoloader()
 {
     // load interfaces
     espresso_load_required('EEH_Autoloader', EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php');
     EEH_Autoloader::instance();
 }
 /**
  * load_espresso_addons
  *
  * allow addons to load first so that they can set hooks for running DMS's, etc
  * this is hooked into both:
  * 	'AHEE__EE_Bootstrap__load_core_configuration'
  * 		which runs during the WP 'plugins_loaded' action at priority 5
  * 	and the WP 'activate_plugin' hookpoint
  *
  * @access public
  * @return void
  */
 public function load_espresso_addons()
 {
     // set autoloaders for all of the classes implementing EEI_Plugin_API
     // which provide helpers for EE plugin authors to more easily register certain components with EE.
     EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES . 'plugin_api');
     //load and setup EE_Capabilities
     EE_Registry::instance()->load_core('Capabilities');
     //caps need to be initialized on every request so that capability maps are set.
     //@see https://events.codebasehq.com/projects/event-espresso/tickets/8674
     EE_Registry::instance()->CAP->init_caps();
     do_action('AHEE__EE_System__load_espresso_addons');
 }