Ejemplo n.º 1
0
 static function init()
 {
     add_filter('em_wp_localize_script', array('EM_Gateways', 'em_wp_localize_script'), 10, 1);
     //add to booking interface (menu options, booking statuses)
     add_action('em_bookings_table', array('EM_Gateways', 'em_bookings_table'), 10, 1);
     //Menus
     if (is_admin()) {
         add_action('em_create_events_submenu', array('EM_Gateways', 'admin_menu'), 10, 1);
         if (!empty($_REQUEST['page']) && $_REQUEST['page'] == 'events-manager-gateways') {
             add_action('admin_init', array('EM_Gateways', 'handle_gateways_panel_updates'), 10, 1);
         }
         add_action('em_options_page_footer_bookings', array('EM_Gateways', 'admin_options'));
     }
     // Payment return
     add_action('wp_ajax_em_payment', array('EM_Gateways', 'handle_payment_gateways'), 10);
     //Booking interception
     if (get_option('dbem_multiple_bookings') && !(!empty($_REQUEST['manual_booking']) && wp_verify_nonce($_REQUEST['manual_booking'], 'em_manual_booking_' . $_REQUEST['event_id']))) {
         //Multiple bookings mode (and not doing a manual booking)
         add_action('em_multiple_booking_add', array('EM_Gateways', 'em_booking_add'), 10, 3);
         add_filter('em_multiple_booking_get_post', array('EM_Gateways', 'em_booking_get_post'), 10, 2);
         add_filter('em_action_emp_checkout', array('EM_Gateways', 'em_action_booking_add'), 10, 2);
         //adds gateway var to feedback
         //Booking Form Modifications
         //buttons only way, oudated but still possible, will eventually depreciated this once an API is out, so use the latter pls
         add_filter('em_checkout_form_buttons', array('EM_Gateways', 'booking_form_buttons'), 10, 2);
         //Replace button with booking buttons
         //new way, with payment selector
         add_action('em_checkout_form_footer', array('EM_Gateways', 'booking_form_footer'), 10, 2);
     } else {
         //Normal Bookings mode, or manual booking
         add_action('em_booking_add', array('EM_Gateways', 'em_booking_add'), 10, 3);
         add_filter('em_booking_get_post', array('EM_Gateways', 'em_booking_get_post'), 10, 2);
         add_filter('em_action_booking_add', array('EM_Gateways', 'em_action_booking_add'), 10, 2);
         //adds gateway var to feedback
         //Booking Form Modifications
         //buttons only way, oudated but still possible, will eventually depreciated this once an API is out, so use the latter pls
         add_filter('em_booking_form_buttons', array('EM_Gateways', 'booking_form_buttons'), 10, 2);
         //Replace button with booking buttons
         //new way, with payment selector
         add_action('em_booking_form_footer', array('EM_Gateways', 'event_booking_form_footer'), 10, 2);
     }
     add_filter('em_booking_delete', array('EM_Gateways', 'em_booking_delete'), 10, 2);
     //Gateways and user fields
     add_action('admin_init', array('EM_Gateways', 'customer_fields_admin_actions'), 9);
     //before bookings
     add_action('emp_forms_admin_page', array('EM_Gateways', 'customer_fields_admin'), 30);
     self::$customer_fields = array('address' => __('Address', 'em-pro'), 'address_2' => __('Address Line 2', 'em-pro'), 'city' => __('City', 'em-pro'), 'state' => __('State/County', 'em-pro'), 'zip' => __('Zip/Post Code', 'em-pro'), 'country' => __('Country', 'em-pro'), 'phone' => __('Phone', 'em-pro'), 'fax' => __('Fax', 'em-pro'), 'company' => __('Company', 'em-pro'));
 }