/** * constructor * @constructor * @access public * @return void */ public function __construct($routing = TRUE) { //make sure messages autoloader is running EE_Registry::instance()->load_lib('Messages_Init'); EE_Registry::instance()->load_helper('MSG_Template'); EE_Messages_Init::set_autoloaders(); parent::__construct($routing); }
protected function _set_list_table_views_default() { //for notification related bulk actions we need to make sure only active messengers have an option. EE_Messages_Init::set_autoloaders(); $EEMSG = EE_Registry::instance()->load_lib('messages'); $active_mts = $EEMSG->get_active_message_types(); //key= bulk_action_slug, value= message type. $match_array = array('approve_registration' => 'registration', 'decline_registration' => 'declined_registration', 'pending_registration' => 'pending_approval', 'no_approve_registration' => 'not_approved_registration', 'cancel_registration' => 'cancelled_registration'); /** setup reg status bulk actions **/ $def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); if (in_array($match_array['approve_registration'], $active_mts)) { $def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); } $def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); if (in_array($match_array['decline_registration'], $active_mts)) { $def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); } $def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); if (in_array($match_array['pending_registration'], $active_mts)) { $def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); } $def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); if (in_array($match_array['no_approve_registration'], $active_mts)) { $def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); } $def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); if (in_array($match_array['cancel_registration'], $active_mts)) { $def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); } $this->_views = array('all' => array('slug' => 'all', 'label' => __('View All Registrations', 'event_espresso'), 'count' => 0, 'bulk_action' => array_merge($def_reg_status_actions, array('trash_registrations' => __('Trash Registrations', 'event_espresso')))), 'month' => array('slug' => 'month', 'label' => __('This Month', 'event_espresso'), 'count' => 0, 'bulk_action' => array_merge($def_reg_status_actions, array('trash_registrations' => __('Trash Registrations', 'event_espresso')))), 'today' => array('slug' => 'today', 'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp', 0))), 'count' => 0, 'bulk_action' => array_merge($def_reg_status_actions, array('trash_registrations' => __('Trash Registrations', 'event_espresso')))), 'trash' => array('slug' => 'trash', 'label' => __('Trash', 'event_espresso'), 'count' => 0, 'bulk_action' => array('restore_registrations' => __('Restore Registrations', 'event_espresso'), 'delete_registrations' => __('Delete Registrations Permanently', 'event_espresso')))); }
/** * this just returns and array of instantiated shortcode objects given an array of object refs * * @access private * @param $sc_refs * @throws EE_Error * @return array an array of EE_Shortcode objects */ private function _get_shortcode_objects($sc_refs) { $sc_objs = array(); EE_Messages_Init::set_autoloaders(); foreach ($sc_refs as $shortcode_ref) { $ref = ucwords(str_replace('_', ' ', $shortcode_ref)); $ref = str_replace(' ', '_', $ref); $classname = 'EE_' . $ref . '_Shortcodes'; if (!class_exists($classname)) { $msg[] = __('Shortcode library loading fail.', 'event_espresso'); $msg[] = sprintf(__('The class name checked was "%s". Please check the spelling and case of this reference and make sure it matches the appropriate shortcode library file name (minus the extension) in the "/library/shortcodes/" directory', 'event_espresso'), $classname); throw new EE_Error(implode('||', $msg)); } $a = new ReflectionClass($classname); $sc_objs[] = $a->newInstance(); } return $sc_objs; }
private static function _set_autoloader() { EE_Registry::instance()->load_lib('Messages_Init'); EE_Messages_Init::set_autoloaders(); }
/** * load the active files needed (key word... NEEDED) * @param string $kind indicates what kind of files we are loading. * @param array $actives indicates what active types of the $kind are actually to be loaded. */ private function _load_files($kind, $actives) { $active_names = array(); $base_path = EE_LIBRARIES . 'messages' . DS . $kind . DS; if (empty($actives)) { return false; } //make sure autoloaders are set (failsafe) EE_Messages_Init::set_autoloaders(); //make sure $actives is an array $actives = (array) $actives; EE_Registry::instance()->load_helper('File'); foreach ($actives as $active) { $msg_name = 'EE_' . ucwords(str_replace(' ', '_', $active)) . '_' . $kind; $filename = $msg_name . '.class.php'; $load_file = $base_path . DS . $filename; if (is_readable($load_file)) { require_once $load_file; $active_names[$active] = $msg_name; } else { $this->_unset_active($active, $kind); //set WP_Error return EE_Error::add_error(sprintf(__("Missing messages system file set as inactive: (%s) %s has been made inactive.", 'event_espresso'), $load_file, $msg_name), __FILE__, __FUNCTION__, __LINE__); } } return $active_names; }