/**
 * ee_deprecated__registration_checkout__button_text
 *
 * @param string       $submit_button_text
 * @param \EE_Checkout $checkout
 * @return string
 */
function ee_deprecated__registration_checkout__button_text($submit_button_text, EE_Checkout $checkout)
{
    // list of old filters
    $deprecated_filters = array('update_registration_details' => true, 'process_payment' => true, 'finalize_registration' => true, 'and_proceed_to_payment' => true, 'proceed_to' => true);
    // loop thru and call doing_it_wrong() or remove any that aren't being used
    foreach ($deprecated_filters as $deprecated_filter => $on) {
        // was this filter called ?
        if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter)) {
            // only display doing_it_wrong() notice to Event Admins during non-AJAX requests
            if (EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter') && !defined('DOING_AJAX')) {
                EE_Error::doing_it_wrong('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, sprintf(__('The %1$s filter is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', 'event_espresso'), 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, '<br />', 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', '/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php'), '4.6.10', E_USER_DEPRECATED);
            }
        } else {
            unset($deprecated_filters[$deprecated_filter]);
        }
    }
    if (!empty($deprecated_filters)) {
        if ($checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) {
            $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text);
        } else {
            if ($checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset($deprecated_filters['process_payment'])) {
                $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text);
            } else {
                if ($checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset($deprecated_filters['finalize_registration'])) {
                    $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text);
                }
            }
        }
        if ($checkout->next_step instanceof EE_SPCO_Reg_Step) {
            if ($checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset($deprecated_filters['and_proceed_to_payment'])) {
                $submit_button_text .= apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text);
            }
            if ($checkout->next_step->slug() != 'finalize_registration' && !$checkout->revisit && isset($deprecated_filters['proceed_to'])) {
                $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text) . $checkout->next_step->name();
            }
        }
    }
    return $submit_button_text;
}