protected function _payment_methods_list() { /** * first let's ensure payment methods have been setup. We do this here because when people activate a * payment method for the first time (as an addon), it may not setup its capabilities or get registered correctly due * to the loading process. However, people MUST setup the details for the payment method so its safe to do a * recheck here. */ EE_Registry::instance()->load_lib('Payment_Method_Manager'); EEM_Payment_Method::instance()->verify_button_urls(); EE_Registry::instance()->load_helper('Tabbed_Content'); EE_Registry::instance()->load_helper('HTML'); //setup tabs, one for each payment method type $tabs = array(); $payment_methods = array(); foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { // we don't want to show admin-only PMTs for now if ($pmt_obj instanceof EE_PMT_Admin_Only) { continue; } //check access if (!EE_Registry::instance()->CAP->current_user_can($pmt_obj->cap_name(), 'specific_payment_method_type_access')) { continue; } //check for any active pms of that type $payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name()); if (!$payment_method instanceof EE_Payment_Method) { $payment_method = EE_Payment_Method::new_instance(array('PMD_slug' => sanitize_key($pmt_obj->system_name()), 'PMD_type' => $pmt_obj->system_name(), 'PMD_name' => $pmt_obj->pretty_name(), 'PMD_admin_name' => $pmt_obj->pretty_name())); } $payment_methods[$payment_method->slug()] = $payment_method; } $payment_methods = apply_filters('FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods); foreach ($payment_methods as $payment_method) { if ($payment_method instanceof EE_Payment_Method) { add_meta_box('espresso_' . $payment_method->slug() . '_payment_settings', sprintf(__('%s Settings', 'event_espresso'), $payment_method->admin_name()), array($this, 'payment_method_settings_meta_box'), null, 'normal', 'default', array('payment_method' => $payment_method)); //setup for tabbed content $tabs[$payment_method->slug()] = array('label' => $payment_method->admin_name(), 'class' => $payment_method->active() ? 'gateway-active' : '', 'href' => 'espresso_' . $payment_method->slug() . '_payment_settings', 'title' => __('Modify this Payment Method', 'event_espresso'), 'slug' => $payment_method->slug()); } } $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug()); $this->display_admin_page_with_sidebar(); }
public function messages_metabox($event, $callback_args) { //let's get the active messengers (b/c messenger objects have the active message templates) //convert 'evt_id' to 'EVT_ID' $this->_req_data['EVT_ID'] = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL; $this->_req_data['EVT_ID'] = isset($this->_req_data['post']) && empty($this->_req_data['EVT_ID']) ? $this->_req_data['post'] : $this->_req_data['EVT_ID']; $this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID']) && isset($this->_req_data['evt_id']) ? $this->_req_data['evt_id'] : $this->_req_data['EVT_ID']; $EEM_controller = new EE_messages(); $active_messengers = $EEM_controller->get_active_messengers(); $tabs = array(); //empty messengers? //Note message types will always have at least one available because every messenger has a default message type associated with it (payment) if no other message types are selected. if (empty($active_messengers)) { $msg_activate_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'settings'), EE_MSG_ADMIN_URL); $error_msg = sprintf(__('There are no active messengers. So no notifications will go out for <strong>any</strong> events. You will want to %sActivate a Messenger%s.', 'event_espresso'), '<a href="' . $msg_activate_url . '">', '</a>'); $error_content = '<div class="error"><p>' . $error_msg . '</p></div>'; $internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>'; echo $error_content; echo $internal_content; return; } $event_id = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL; //get content for active messengers foreach ($active_messengers as $name => $messenger) { //first check if there are any active message types for this messenger. $active_mts = $EEM_controller->get_active_message_types_per_messenger($name); if (empty($active_mts)) { continue; } $tcont = $messenger->get_messenger_admin_page_content('events', 'edit', array('event' => $event_id)); if (!empty($tcont)) { $tabs[$name] = $tcont; } } EE_Registry::instance()->load_helper('Tabbed_Content'); //we want this to be tabbed content so let's use the EEH_Tabbed_Content::display helper. $tabbed_content = EEH_Tabbed_Content::display($tabs); if (is_wp_error($tabbed_content)) { $tabbed_content = $tabbed_content->get_error_message(); } $notices = '<div id="espresso-ajax-loading" class="ajax-loader-grey"> <span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso') . '</span> </div><div class="ee-notices"></div>'; if (defined('DOING_AJAX')) { return $tabbed_content; } do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content'); echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>'; do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content'); }
/** * Used for setting up messenger/message type activation. This loads up the initial view. The rest is handled by ajax and other routes. * @return void */ protected function _settings() { EE_Registry::instance()->load_helper('Tabbed_Content'); $this->_set_m_mt_settings(); $selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email'; //let's setup the messenger tabs $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger); $this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">'; $this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->'; $this->display_admin_page_with_sidebar(); }
/** * This returns the admin_nav tabs html using the configuration in the _nav_tabs property * @return string html */ protected function _get_main_nav_tabs() { //let's generate the html using the EEH_Tabbed_Content helper. We do this here so that it's possible for child classes to add in nav tabs dynamically at the last minute (rather than setting in the page_routes array) EE_Registry::instance()->load_helper('Tabbed_Content'); return EEH_Tabbed_Content::display_admin_nav_tabs($this->_nav_tabs); }
protected function _gateway_settings() { require_once EE_MODELS . 'EEM_Gateways.model.php'; $EEM_Gateways = EEM_Gateways::instance(); EE_Registry::instance()->load_helper('Tabbed_Content'); $gateway_instances = $EEM_Gateways->get_gateway_instances(); $payment_settings = EE_Registry::instance()->CFG->gateway->payment_settings; //get_user_meta($current_user->ID, 'payment_settings', true); //lets add all the metaboxes foreach ($gateway_instances as $gate_obj) { $gate_obj->add_settings_page_meta_box(); } //printr( $gateway_data, '$gateway_data <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); $selected_gateway_name = null; $gateways = array(); //let's assemble the array for the _tab_text_links helper foreach ($payment_settings as $gateway => $settings) { if (isset($this->_req_data['activate_' . $gateway]) || isset($this->_req_data['deactivate_' . $gateway]) || isset($this->_req_data['update_' . $gateway])) { $selected_gateway_name = $gateway; } // now add or remove gateways from list if (isset($this->_req_data['activate_' . $gateway])) { //bandaid to fix bug where gateways wouldn't appear active on firsrt pag eload after activating them $EEM_Gateways->set_active($gateway); } if (isset($this->_req_data['deactivate_' . $gateway])) { //bandaid to fix bug where gateways wouldn't appear active on firsrt pag eload after activating them $EEM_Gateways->unset_active($gateway); } $gateways[$gateway] = array('label' => isset($settings['display_name']) ? $settings['display_name'] : ucwords(str_replace('_', ' ', $gateway)), 'class' => isset(EE_Registry::instance()->CFG->gateway->active_gateways[$gateway]) ? 'gateway-active' : '', 'href' => 'espresso_' . str_replace(' ', '_', $gateway) . '_payment_settings', 'title' => __('Modify this Gateway', 'event_espresso'), 'slug' => $gateway); } if (!$selected_gateway_name) { // $default = !empty( $gateway_data['active_gateways'] ) ? key($gateway_data['active_gateways']) : 'Paypal_Standard'; $selected_gateway_name = !empty($gateways) ? key($gateways) : 'Paypal_Standard'; } //$gateways = isset( $gateways ) ? $gateways : array(); //printr( $gateways, '$gateways <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($gateways, 'gateway_links', '|', $selected_gateway_name); $this->display_admin_page_with_sidebar(); }