/** * 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(); }
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(); }
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(); }