<?php 

/* ----------------------------------------------------------------------------- */
/* Setting Sections And Fields */
/* ----------------------------------------------------------------------------- */ 

function envy_chimp_initialize_global_options() {  
    add_settings_section( 'page_1_section', '', '', 'envy-chimp-menu-slug-1' );
    add_settings_section( 'page_2_section', '', '', 'envy-chimp-menu-slug-2' );
    add_settings_section( 'page_3_section', '', '', 'envy-chimp-menu-slug-3' );
    add_settings_section( 'page_4_section', '', '', 'envy-chimp-menu-slug-4' );

    /* ----------------------------------------------------------------------------- */
    /* Option 1 */
    /* ----------------------------------------------------------------------------- */

    add_settings_field ( 'option_subscribe_style', __('Select Subscribe Style', 'envy-chimp'), 'envy_chimp_subscribe_style_callback', 'envy-chimp-menu-slug-1', 'page_1_section', array( '' ) );

    add_settings_field ( 'option_signup_style', __('Select Signup Style', 'envy-chimp'), 'envy_chimp_signup_style_callback', 'envy-chimp-menu-slug-1', 'page_1_section', array( '' ) );

    add_settings_field ( 'option_subscribe_area', __('Select Subscribe Form Area', 'envy-chimp'), 'envy_chimp_subscribe_area_callback', 'envy-chimp-menu-slug-1', 'page_1_section', array( '' ) );

    add_settings_field ( 'option_signup_area', __('Select Signup Form Area', 'envy-chimp'), 'envy_chimp_signup_area_callback', 'envy-chimp-menu-slug-1', 'page_1_section', array( '' ) );

    add_settings_field ( 'option_signup_notice', __('', 'envy-chimp'), 'envy_chimp_signup_notice_callback', 'envy-chimp-menu-slug-1', 'page_1_section', array( '' ) );

    add_settings_field ( 'form_action_url', __('Subscribe Form Action URL', 'envy-chimp'), 'envy_chimp_form_action_url_callback', 'envy-chimp-menu-slug-1', 'page_1_section', array( '' ) );

    add_settings_field ( 'page_redirect_url', __('Redirect URL After Subscribe', 'envy-chimp'), 'envy_chimp_page_redirect_url_callback', 'envy-chimp-menu-slug-1', 'page_1_section', array( '' ) );

    add_settings_field ( 'privacy_policy_page_url', __('Privacy Policy Page URL', 'envy-chimp'), 'envy_chimp_privacy_policy_page_url_callback', 'envy-chimp-menu-slug-1', 'page_1_section', array( '' ) );

    add_settings_field ( 'terms_conditions_page_url', __('Terms & Conditions Page URL', 'envy-chimp'), 'envy_chimp_terms_conditions_page_url_callback', 'envy-chimp-menu-slug-1', 'page_1_section', array( '' ) );

    register_setting( 'setting-group-1', 'new_settings1' );

    /* ----------------------------------------------------------------------------- */
    /* Option 2 */
    /* ----------------------------------------------------------------------------- */
    
    // Subscribe form
    add_settings_field ( 'option_title', __('Subscribe Title', 'envy-chimp'), 'envy_chimp_title_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    add_settings_field ( 'option_title_font_size', __('Title Font Size', 'envy-chimp'), 'envy_chimp_title_font_size_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) ); 

    add_settings_field ( 'option_desc', __('Subscribe Description', 'envy-chimp'), 'envy_chimp_desc_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    add_settings_field ( 'option_desc_font_size', __('Description Font Size', 'envy-chimp'), 'envy_chimp_desc_font_size_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    add_settings_field ( 'option_heading', __('Subscribe Heading', 'envy-chimp'), 'envy_chimp_heading_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    add_settings_field ( 'option_heading_font_size', __('Heading Font Size', 'envy-chimp'), 'envy_chimp_heading_font_size_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    add_settings_field ( 'option_email_address_field_text', __('Subscribe Email Field Text', 'envy-chimp'), 'envy_chimp_email_address_field_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    add_settings_field ( 'option_subscribe_btn_text', __('Subscribe Button Text', 'envy-chimp'), 'envy_chimp_subscribe_btn_text_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );   

    add_settings_field ( 'option_subscribe_success_msg', __('Subscribe Success Message', 'envy-chimp'), 'envy_chimp_subscribe_success_msg_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    // Signup form
    add_settings_field ( 'option_signup_heading', __('Signup Heading', 'envy-chimp'), 'envy_chimp_signup_heading_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    add_settings_field ( 'option_signup_heading_font_size', __('Signup Heading Font Size', 'envy-chimp'), 'envy_chimp_signup_heading_font_size_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    add_settings_field ( 'option_signup_heading_color', __('Signup Heading Color', 'envy-chimp'), 'envy_chimp_signup_heading_color_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    add_settings_field ( 'option_signup_title', __('Signup Title', 'envy-chimp'), 'envy_chimp_signup_title_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    add_settings_field ( 'option_signup_title_font_size', __('Signup Title Font Size', 'envy-chimp'), 'envy_chimp_signup_title_font_size_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    add_settings_field ( 'option_signup_title_color', __('Signup Title Color', 'envy-chimp'), 'envy_chimp_signup_title_color_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    add_settings_field ( 'option_login_title', __('Login Title', 'envy-chimp'), 'envy_chimp_login_title_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    add_settings_field ( 'option_login_title_font_size', __('Login Title Font Size', 'envy-chimp'), 'envy_chimp_login_title_font_size_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    add_settings_field ( 'option_login_title_color', __('Login Title Color', 'envy-chimp'), 'envy_chimp_login_title_color_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    add_settings_field ( 'option_user_name_field_text', __('Signup Username Field Text', 'envy-chimp'), 'envy_chimp_user_name_field_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    add_settings_field ( 'option_email_field_text', __('Signup Email Field Text', 'envy-chimp'), 'envy_chimp_email_field_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    add_settings_field ( 'option_password_field_text', __('Signup Password Field Text', 'envy-chimp'), 'envy_chimp_password_field_callback', 'envy-chimp-menu-slug-2', 'page_2_section', array( '' ) );

    register_setting( 'setting-group-2', 'new_settings2' );
    
    // Image 1
    add_settings_section('image_section', '', '', 'envy-chimp-image-options');

    add_settings_field('bg_image_hide', __('Hide Subscribe Image', 'envy-chimp'), 'envy_chimp_bg_image_hide', 'envy-chimp-image-options', 'image_section');

    register_setting( 'image_section', 'new_settings' );

    add_settings_field('background_picture', __('Subscribe Image Upload', 'envy-chimp'), 'envy_chimp_background_form_element', 'envy-chimp-image-options', 'image_section');

    register_setting('image_section', 'background_picture', 'envy_chimp_handle_file_upload');

    // Image 2
    add_settings_section('image_two_section', '', '', 'envy-chimp-image-two-options');

    add_settings_field('bg_image_two_hide', __('Hide Signup Image', 'envy-chimp'), 'envy_chimp_bg_image_two_hide', 'envy-chimp-image-two-options', 'image_two_section');

    register_setting( 'image_two_section', 'new_settings_two' );

    add_settings_field('background_picture_two', __('Signup Image Upload', 'envy-chimp'), 'envy_chimp_background_two_form_element', 'envy-chimp-image-two-options', 'image_two_section');

    register_setting('image_two_section', 'background_picture_two', 'envy_chimp_handle_file_two_upload');

    /* ----------------------------------------------------------------------------- */
    /* Option 3 */
    /* ----------------------------------------------------------------------------- */

    add_settings_field ( 'option_appearance_enable', __('Enable Custom Style', 'envy-chimp'), 'envy_chimp_appearance_enable_callback', 'envy-chimp-menu-slug-3', 'page_3_section', array( '' ) );

    add_settings_field ( 'option_form_width', 'Form Width', 'envy_chimp_form_width_callback', 'envy-chimp-menu-slug-3', 'page_3_section', array( '' ) );

    add_settings_field ( 'option_form_height', 'Form Height', 'envy_chimp_form_height_callback', 'envy-chimp-menu-slug-3', 'page_3_section', array( '' ) );

    add_settings_field ( 'option_form_bg_color', 'Form Background Color', 'envy_chimp_form_bg_color_callback', 'envy-chimp-menu-slug-3', 'page_3_section', array( '' ) );

    add_settings_field ( 'option_input_field_bg_color', 'Input Field Background Color', 'envy_chimp_input_field_bg_color_callback', 'envy-chimp-menu-slug-3', 'page_3_section', array( '' ) );

    add_settings_field ( 'option_input_field_width', 'Input Field Width', 'envy_chimp_input_field_width_callback', 'envy-chimp-menu-slug-3', 'page_3_section', array( '' ) );

    add_settings_field ( 'option_input_field_padding', 'Input Field Padding', 'envy_chimp_input_field_padding_callback', 'envy-chimp-menu-slug-3', 'page_3_section', array( '' ) );

    add_settings_field ( 'option_input_field_border', 'Input Field Border', 'envy_chimp_input_field_border_callback', 'envy-chimp-menu-slug-3', 'page_3_section', array( '' ) );

    add_settings_field ( 'option_input_field_border_radius', 'Input Field Border Radius', 'envy_chimp_input_field_border_radius_callback', 'envy-chimp-menu-slug-3', 'page_3_section', array( '' ) );

    add_settings_field ( 'option_submit_btn_font_size', 'Submit Button Font Size', 'envy_chimp_submit_btn_font_size_callback', 'envy-chimp-menu-slug-3', 'page_3_section', array( '' ) ); 

    add_settings_field ( 'option_submit_btn_bg_color', 'Submit Button Background Color', 'envy_chimp_submit_btn_bg_color_callback', 'envy-chimp-menu-slug-3', 'page_3_section', array( '' ) );

    add_settings_field ( 'option_submit_btn_bg_hover_color', 'Submit Button Background Hover Color', 'envy_chimp_submit_btn_bg_hover_color_callback', 'envy-chimp-menu-slug-3', 'page_3_section', array( '' ) );

    add_settings_field ( 'option_submit_btn_font_color', 'Submit Button Font Color', 'envy_chimp_submit_btn_font_color_callback', 'envy-chimp-menu-slug-3', 'page_3_section', array( '' ) ); 

    register_setting( 'setting-group-3', 'new_settings3' );

    /* ----------------------------------------------------------------------------- */
    /* Option 4 */
    /* ----------------------------------------------------------------------------- */

    add_settings_field("option_social_enable", __('Enable Social Media', 'envy-chimp'), "envy_chimp_social_enable_callback",  'envy-chimp-menu-slug-4', 'page_4_section', array( '' ) );

    add_settings_field("option_social_title", __('EnvyChimp Social Title', 'envy-chimp'), "envy_chimp_social_title_callback",  'envy-chimp-menu-slug-4', 'page_4_section', array( '' ) );

    add_settings_field("option_social_fb", __('Facebook Link', 'envy-chimp'), "envy_chimp_social_fb_callback",  'envy-chimp-menu-slug-4', 'page_4_section', array( '' ) ); 

    add_settings_field("option_social_tw", __('Twitter Link', 'envy-chimp'), "envy_chimp_social_tw_callback",  'envy-chimp-menu-slug-4', 'page_4_section', array( '' ) );

    add_settings_field("option_social_li", __('Linkedin Link', 'envy-chimp'), "envy_chimp_social_li_callback",  'envy-chimp-menu-slug-4', 'page_4_section', array( '' ) );

    add_settings_field("option_social_pi", __('Pinterest Link', 'envy-chimp'), "envy_chimp_social_pi_callback",  'envy-chimp-menu-slug-4', 'page_4_section', array( '' ) );

    add_settings_field("option_social_yt", __('Youtube Link', 'envy-chimp'), "envy_chimp_social_yt_callback",  'envy-chimp-menu-slug-4', 'page_4_section', array( '' ) );

    register_setting("setting-group-4", "new_settings4");      

}
add_action('admin_init', 'envy_chimp_initialize_global_options');

/* ----------------------------------------------------------------------------- */
/* Field Callbacks 1 */
/* ----------------------------------------------------------------------------- */ 

// Select subscribe style
function envy_chimp_subscribe_style_callback() {
    $option_subscribe_style = (array)get_option('new_settings1');
    if( isset( $option_subscribe_style['option_subscribe_style'] ) ) :
        $option_subscribe_style_new = $option_subscribe_style['option_subscribe_style'];
    else:
        $option_subscribe_style_new = '';
    endif; ?>
    <select name="new_settings1[option_subscribe_style]">
        <option value="none" <?php if(isset($option_subscribe_style_new)) : selected($option_subscribe_style_new, "none"); endif; ?>><?php echo esc_html__('None', 'envy-chimp'); ?>
        </option>
        <option value="style-1" <?php if(isset($option_subscribe_style_new)) : selected($option_subscribe_style_new, "style-1"); endif; ?>><?php echo esc_html__('Style 1', 'envy-chimp'); ?>
        </option>
        <option value="style-2" <?php if(isset($option_subscribe_style_new)) : selected($option_subscribe_style_new, "style-2"); endif; ?>><?php echo esc_html__('Style 2', 'envy-chimp'); ?></option>
        <option value="style-3" <?php if(isset($option_subscribe_style_new)) : selected($option_subscribe_style_new, "style-3"); endif; ?>><?php echo esc_html__('Style 3', 'envy-chimp'); ?>
        </option>
        <option value="style-4" <?php if(isset($option_subscribe_style_new)) : selected($option_subscribe_style_new, "style-4"); endif; ?>><?php echo esc_html__('Style 4', 'envy-chimp'); ?>
        </option>         
    </select>

<?php }

// Select signup style
function envy_chimp_signup_style_callback() {
    $option_signup_style = (array)get_option('new_settings1');
    if( isset( $option_signup_style['option_signup_style'] ) ) :
        $option_signup_style_new = $option_signup_style['option_signup_style'];
    else:
        $option_signup_style_new = '';
    endif; ?>
    <select name="new_settings1[option_signup_style]">
        <option value="none" <?php if(isset($option_signup_style_new)) : selected($option_signup_style_new, "none"); endif; ?>><?php echo esc_html__('None', 'envy-chimp'); ?>
        </option>
        <option value="style-1" <?php if(isset($option_signup_style_new)) : selected($option_signup_style_new, "style-1"); endif; ?>><?php echo esc_html__('Style 1', 'envy-chimp'); ?>
        </option>
        <option value="style-2" <?php if(isset($option_signup_style_new)) : selected($option_signup_style_new, "style-2"); endif; ?>><?php echo esc_html__('Style 2', 'envy-chimp'); ?></option>
        <option value="style-3" <?php if(isset($option_signup_style_new)) : selected($option_signup_style_new, "style-3"); endif; ?>><?php echo esc_html__('Style 3', 'envy-chimp'); ?>
        </option>
        <option value="style-4" <?php if(isset($option_signup_style_new)) : selected($option_signup_style_new, "style-4"); endif; ?>><?php echo esc_html__('Style 4', 'envy-chimp'); ?>
        </option>                 
    </select>

<?php }

// Select subscribe form area
function envy_chimp_subscribe_area_callback() {
    $option_subscribe_area = (array)get_option('new_settings1');
    if( isset( $option_subscribe_area['option_subscribe_area'] ) ) :
        $option_subscribe_area_new = $option_subscribe_area['option_subscribe_area'];
    else:
        $option_subscribe_area_new = '';
    endif; ?>
    <select name="new_settings1[option_subscribe_area]">
        <option value="default" <?php if(isset($option_subscribe_area_new)) : selected($option_subscribe_area_new, "default"); endif; ?>><?php echo esc_html__('Default', 'envy-chimp'); ?>
        </option>
        <option value="full-width" <?php if(isset($option_subscribe_area_new)) : selected($option_subscribe_area_new, "full-width"); endif; ?>><?php echo esc_html__('Full Width', 'envy-chimp'); ?>
        </option>                
    </select>

<?php }

// Select signup form area
function envy_chimp_signup_area_callback() {
    $option_signup_area = (array)get_option('new_settings1');
    if( isset( $option_signup_area['option_signup_area'] ) ) :
        $option_signup_area_new = $option_signup_area['option_signup_area'];
    else:
        $option_signup_area_new = '';
    endif; ?>
    <select name="new_settings1[option_signup_area]">
        <option value="default" <?php if(isset($option_signup_area_new)) : selected($option_signup_area_new, "default"); endif; ?>><?php echo esc_html__('Default', 'envy-chimp'); ?>
        </option>
        <option value="full-width" <?php if(isset($option_signup_area_new)) : selected($option_signup_area_new, "full-width"); endif; ?>><?php echo esc_html__('Full Width', 'envy-chimp'); ?>
        </option>                
    </select>

<?php }

// Signup notice display
function envy_chimp_signup_notice_callback() {
    echo __('For use signup form, you have to first enable Anyone can register'.'<br>'.'<b><a href="options-general.php">Settings - General - Membership - Anyone can register</b></a>', 'envy-chimp');
} 

// Form action url
function envy_chimp_form_action_url_callback() {
    $form_action_url = (array)get_option('new_settings1');
    if( isset($form_action_url['form_action_url']) ) :
        $form_action_url_new = $form_action_url['form_action_url'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings1[form_action_url]'); ?>" value="<?php if( isset( $form_action_url_new ) ) : echo esc_attr( $form_action_url_new ); else : echo esc_html__('https://envytheme.us20.list-manage.com/subscribe/post?u=60e1ffe2e8a68ce1204cd39a5&amp;id=42d6d188d9', 'envy-chimp'); endif; ?>" class="regular-text"><br/><br/>
    <?php if( isset( $form_action_url_new ) && ! $form_action_url_new == '' ) :
        echo wp_kses_post('<p style="color:green;"><i class="fa fa-check"></i> <strong>Form</strong> is now connected with mailchimp account.</p>', 'envy-chimp'); ?><br/>
    <?php else:
        echo wp_kses_post('<p style="color:red;"><i class="fa fa-close"></i> <strong>Form</strong> is not connected with mailchimp account.</p>', 'envy-chimp'); ?><br/>
    <?php endif; ?>
    <?php echo wp_kses_post('Get this URL from your mailchimp account <a href="https://us7.admin.mailchimp.com/lists/dashboard/signup-forms/" target="_blank">Click here</a>', 'envy-chimp'); ?>
<?php }

// Page redirect url
function envy_chimp_page_redirect_url_callback() {
    $page_redirect_url = (array)get_option('new_settings1');
    if( isset($page_redirect_url['page_redirect_url']) ) :
        $page_redirect_url_new = $page_redirect_url['page_redirect_url'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings1[page_redirect_url]'); ?>" value="<?php if( isset( $page_redirect_url_new ) ) : echo esc_attr( $page_redirect_url_new ); else : echo esc_html__('https://envytheme.com', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Privacy policy page url
function envy_chimp_privacy_policy_page_url_callback() {
    $privacy_policy_page_url = (array)get_option('new_settings1');
    if( isset($privacy_policy_page_url['privacy_policy_page_url']) ) :
        $privacy_policy_page_url_new = $privacy_policy_page_url['privacy_policy_page_url'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings1[privacy_policy_page_url]'); ?>" value="<?php if( isset( $privacy_policy_page_url_new ) ) : echo esc_attr( $privacy_policy_page_url_new ); else : echo esc_html__('#', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Terms & Conditions page url
function envy_chimp_terms_conditions_page_url_callback() {
    $terms_conditions_page_url = (array)get_option('new_settings1');
    if( isset($terms_conditions_page_url['terms_conditions_page_url']) ) :
        $terms_conditions_page_url_new = $terms_conditions_page_url['terms_conditions_page_url'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings1[terms_conditions_page_url]'); ?>" value="<?php if( isset( $terms_conditions_page_url_new ) ) : echo esc_attr( $terms_conditions_page_url_new ); else : echo esc_html__('#', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

/* ----------------------------------------------------------------------------- */
/* Field Callbacks 2 */
/* ----------------------------------------------------------------------------- */ 

// Subscribe form title
function envy_chimp_title_callback() {
    $envy_chimp_title = (array)get_option('new_settings2');
    if( isset($envy_chimp_title['option_title']) ) :
        $envy_chimp_title_new = $envy_chimp_title['option_title'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings2[option_title]'); ?>" value="<?php if( isset( $envy_chimp_title_new ) ) : echo esc_attr( $envy_chimp_title_new ); else : echo esc_html__('Never Miss Updates', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Subscribe form title font size
function envy_chimp_title_font_size_callback() {
    $envy_chimp_title_font_size = (array)get_option('new_settings2');
    if( isset($envy_chimp_title_font_size['option_title_font_size']) ) :
        $envy_chimp_title_font_size_new = $envy_chimp_title_font_size['option_title_font_size'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings2[option_title_font_size]'); ?>" value="<?php if( isset( $envy_chimp_title_font_size_new ) ) : echo esc_attr( $envy_chimp_title_font_size_new ); else : echo esc_html__('28px', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Subscribe form description
function envy_chimp_desc_callback() {
    $envy_chimp_desc = (array)get_option('new_settings2');
    if( isset($envy_chimp_desc['option_desc']) ) :
        $envy_chimp_desc_new = $envy_chimp_desc['option_desc'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings2[option_desc]'); ?>" value="<?php if( isset( $envy_chimp_desc_new ) ) : echo esc_attr( $envy_chimp_desc_new ); else : echo esc_html__('We will keep secure your email.', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Subscribe form desc font size
function envy_chimp_desc_font_size_callback() {
    $envy_chimp_desc_font_size = (array)get_option('new_settings2');
    if( isset($envy_chimp_desc_font_size['option_desc_font_size']) ) :
        $envy_chimp_desc_font_size_new = $envy_chimp_desc_font_size['option_desc_font_size'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings2[option_desc_font_size]'); ?>" value="<?php if( isset( $envy_chimp_desc_font_size_new ) ) : echo esc_attr( $envy_chimp_desc_font_size_new ); else : echo esc_html__('16px', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Subscribe form heading
function envy_chimp_heading_callback() {
    $envy_chimp_heading = (array)get_option('new_settings2');
    if( isset($envy_chimp_heading['option_heading']) ) :
        $envy_chimp_heading_new = $envy_chimp_heading['option_heading'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings2[option_heading]'); ?>" value="<?php if( isset( $envy_chimp_heading_new ) ) : echo esc_attr( $envy_chimp_heading_new ); else : echo esc_html__('Subscribe Now!', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Subscribe form heading font size
function envy_chimp_heading_font_size_callback() {
    $envy_chimp_heading_font_size = (array)get_option('new_settings2');
    if( isset($envy_chimp_heading_font_size['option_heading_font_size']) ) :
        $envy_chimp_heading_font_size_new = $envy_chimp_heading_font_size['option_heading_font_size'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings2[option_heading_font_size]'); ?>" value="<?php if( isset( $envy_chimp_heading_font_size_new ) ) : echo esc_attr( $envy_chimp_heading_font_size_new ); else : echo esc_html__('22px', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Email address field text
function envy_chimp_email_address_field_callback() {
    $envy_chimp_email_address_field = (array)get_option('new_settings2');
    if( isset($envy_chimp_email_address_field['option_email_address_field_text']) ) :
        $envy_chimp_email_address_field_new = $envy_chimp_email_address_field['option_email_address_field_text'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings2[option_email_address_field_text]'); ?>" value="<?php if( isset( $envy_chimp_email_address_field_new ) ) : echo esc_attr( $envy_chimp_email_address_field_new ); else : echo esc_html__('Email address', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Subscribe button text
function envy_chimp_subscribe_btn_text_callback() {
    $envy_chimp_subscribe_btn_text = (array)get_option('new_settings2');
    if( isset($envy_chimp_subscribe_btn_text['option_subscribe_btn_text']) ) :
        $envy_chimp_subscribe_btn_text_new = $envy_chimp_subscribe_btn_text['option_subscribe_btn_text'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings2[option_subscribe_btn_text]'); ?>" value="<?php if( isset( $envy_chimp_subscribe_btn_text_new ) ) : echo esc_attr( $envy_chimp_subscribe_btn_text_new ); else : echo esc_html__('Subscribe', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Subscribe success message
function envy_chimp_subscribe_success_msg_callback() {
    $option_subscribe_success_msg = (array)get_option('new_settings2');
    if( isset($option_subscribe_success_msg['option_subscribe_success_msg']) ) :
        $option_subscribe_success_msg_new = $option_subscribe_success_msg['option_subscribe_success_msg'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings2[option_subscribe_success_msg]'); ?>" value="<?php if( isset( $option_subscribe_success_msg_new ) ) : echo esc_attr( $option_subscribe_success_msg_new ); else : echo esc_html__('Thank you for subscribe.', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Background image hide
function envy_chimp_bg_image_hide() {
    $bg_image_hide = (array)get_option('new_settings');
    if( isset( $bg_image_hide['bg_image_hide'] ) ) :
        $bg_image_hide_new = $bg_image_hide['bg_image_hide'];
    else:
        $bg_image_hide_new = '';
    endif;
    echo __('<input type="checkbox" name="new_settings[bg_image_hide]" value="1" '.checked(1, $bg_image_hide_new, false).' >', 'envy-chimp').__('Hide', 'envy-chimp');
} 

// Background picture handle
function envy_chimp_handle_file_upload($options) {
    //check if user had uploaded a file and clicked save changes button
    if(!empty($_FILES["background_picture"]["tmp_name"])) {
        $urls = wp_handle_upload($_FILES["background_picture"], array('test_form' => FALSE));
        if( isset($urls["url"]) ) : 
            $temp = $urls["url"];
            return $temp;
        endif; 

        return $options;
    }

    else {
        $urls = wp_handle_upload($_FILES["background_picture"], array('test_form' => FALSE));
        if( isset($urls["url"]) ) : 
            $temp = $urls["url"];
            return $temp;
        endif; 

        //no upload. old file url is the new value.
        return get_option("background_picture");
    } 
}

// Background picture
function envy_chimp_background_form_element() { ?>
    <input type='file' name='background_picture' id='background_picture' />
    <?php echo get_option('background_picture');
}

// Signup form heading
function envy_chimp_signup_heading_callback() {
    $envy_chimp_signup_heading = (array)get_option('new_settings2');
    if( isset($envy_chimp_signup_heading['option_signup_heading']) ) :
        $envy_chimp_signup_heading_new = $envy_chimp_signup_heading['option_signup_heading'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings2[option_signup_heading]'); ?>" value="<?php if( isset( $envy_chimp_signup_heading_new ) ) : echo esc_attr( $envy_chimp_signup_heading_new ); else : echo esc_html__('EnvyChimp', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Signup form heading font size
function envy_chimp_signup_heading_font_size_callback() {
    $envy_chimp_signup_heading_font_size = (array)get_option('new_settings2');
    if( isset($envy_chimp_signup_heading_font_size['option_signup_heading_font_size']) ) :
        $envy_chimp_signup_heading_font_size_new = $envy_chimp_signup_heading_font_size['option_signup_heading_font_size'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings2[option_signup_heading_font_size]'); ?>" value="<?php if( isset( $envy_chimp_signup_heading_font_size_new ) ) : echo esc_attr( $envy_chimp_signup_heading_font_size_new ); else : echo esc_html__('70px', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Signup form heading color
function envy_chimp_signup_heading_color_callback() {
    $envy_chimp_signup_heading_color = (array)get_option('new_settings2');
    if( isset($envy_chimp_signup_heading_color['option_signup_heading_color']) ) :
        $envy_chimp_signup_heading_color_new = $envy_chimp_signup_heading_color['option_signup_heading_color'];
    endif; ?>
    <input type="color" name="<?php echo esc_attr('new_settings2[option_signup_heading_color]'); ?>" value="<?php if( isset( $envy_chimp_signup_heading_color_new ) ) : echo esc_attr( $envy_chimp_signup_heading_color_new ); else : echo esc_html__('#F1796C', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Signup form title
function envy_chimp_signup_title_callback() {
    $envy_chimp_signup_title = (array)get_option('new_settings2');
    if( isset($envy_chimp_signup_title['option_signup_title']) ) :
        $envy_chimp_signup_title_new = $envy_chimp_signup_title['option_signup_title'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings2[option_signup_title]'); ?>" value="<?php if( isset( $envy_chimp_signup_title_new ) ) : echo esc_attr( $envy_chimp_signup_title_new ); else : echo esc_html__('Signup', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Signup form title font size
function envy_chimp_signup_title_font_size_callback() {
    $envy_chimp_signup_title_font_size = (array)get_option('new_settings2');
    if( isset($envy_chimp_signup_title_font_size['option_signup_title_font_size']) ) :
        $envy_chimp_signup_title_font_size_new = $envy_chimp_signup_title_font_size['option_signup_title_font_size'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings2[option_signup_title_font_size]'); ?>" value="<?php if( isset( $envy_chimp_signup_title_font_size_new ) ) : echo esc_attr( $envy_chimp_signup_title_font_size_new ); else : echo esc_html__('35px', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Signup form title color
function envy_chimp_signup_title_color_callback() {
    $envy_chimp_signup_title_color = (array)get_option('new_settings2');
    if( isset($envy_chimp_signup_title_color['option_signup_title_color']) ) :
        $envy_chimp_signup_title_color_new = $envy_chimp_signup_title_color['option_signup_title_color'];
    endif; ?>
    <input type="color" name="<?php echo esc_attr('new_settings2[option_signup_title_color]'); ?>" value="<?php if( isset( $envy_chimp_signup_title_color_new ) ) : echo esc_attr( $envy_chimp_signup_title_color_new ); else : echo esc_html__('#444444', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Login form title
function envy_chimp_login_title_callback() {
    $envy_chimp_login_title = (array)get_option('new_settings2');
    if( isset($envy_chimp_login_title['option_login_title']) ) :
        $envy_chimp_login_title_new = $envy_chimp_login_title['option_login_title'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings2[option_login_title]'); ?>" value="<?php if( isset( $envy_chimp_login_title_new ) ) : echo esc_attr( $envy_chimp_login_title_new ); else : echo esc_html__('Login', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Login form title font size
function envy_chimp_login_title_font_size_callback() {
    $envy_chimp_login_title_font_size = (array)get_option('new_settings2');
    if( isset($envy_chimp_login_title_font_size['option_login_title_font_size']) ) :
        $envy_chimp_login_title_font_size_new = $envy_chimp_login_title_font_size['option_login_title_font_size'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings2[option_login_title_font_size]'); ?>" value="<?php if( isset( $envy_chimp_login_title_font_size_new ) ) : echo esc_attr( $envy_chimp_login_title_font_size_new ); else : echo esc_html__('35px', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Login form title color
function envy_chimp_login_title_color_callback() {
    $envy_chimp_login_title_color = (array)get_option('new_settings2');
    if( isset($envy_chimp_login_title_color['option_login_title_color']) ) :
        $envy_chimp_login_title_color_new = $envy_chimp_login_title_color['option_login_title_color'];
    endif; ?>
    <input type="color" name="<?php echo esc_attr('new_settings2[option_login_title_color]'); ?>" value="<?php if( isset( $envy_chimp_login_title_color_new ) ) : echo esc_attr( $envy_chimp_login_title_color_new ); else : echo esc_html__('#444444', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// User name field text
function envy_chimp_user_name_field_callback() {
    $envy_chimp_user_name_field = (array)get_option('new_settings2');
    if( isset($envy_chimp_user_name_field['option_user_name_field_text']) ) :
        $envy_chimp_user_name_field_new = $envy_chimp_user_name_field['option_user_name_field_text'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings2[option_user_name_field_text]'); ?>" value="<?php if( isset( $envy_chimp_user_name_field_new ) ) : echo esc_attr( $envy_chimp_user_name_field_new ); else : echo esc_html__('Username*', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Email field text
function envy_chimp_email_field_callback() {
    $envy_chimp_email_field = (array)get_option('new_settings2');
    if( isset($envy_chimp_email_field['option_email_field_text']) ) :
        $envy_chimp_email_field_new = $envy_chimp_email_field['option_email_field_text'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings2[option_email_field_text]'); ?>" value="<?php if( isset( $envy_chimp_email_field_new ) ) : echo esc_attr( $envy_chimp_email_field_new ); else : echo esc_html__('Email Address*', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Password field text
function envy_chimp_password_field_callback() {
    $envy_chimp_password_field = (array)get_option('new_settings2');
    if( isset($envy_chimp_password_field['option_password_field_text']) ) :
        $envy_chimp_password_field_new = $envy_chimp_password_field['option_password_field_text'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings2[option_password_field_text]'); ?>" value="<?php if( isset( $envy_chimp_password_field_new ) ) : echo esc_attr( $envy_chimp_password_field_new ); else : echo esc_html__('Password*', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Background two image hide
function envy_chimp_bg_image_two_hide() {
    $bg_image_two_hide = (array)get_option('new_settings_two');
    if( isset( $bg_image_two_hide['bg_image_two_hide'] ) ) :
        $bg_image_two_hide_new = $bg_image_two_hide['bg_image_two_hide'];
    else:
        $bg_image_two_hide_new = '';
    endif;
    echo __('<input type="checkbox" name="new_settings_two[bg_image_two_hide]" value="1" '.checked(1, $bg_image_two_hide_new, false).' >', 'envy-chimp').__('Hide', 'envy-chimp');
} 

// Background two picture handle
function envy_chimp_handle_file_two_upload($options) {
    //check if user had uploaded a file and clicked save changes button
    if(!empty($_FILES["background_picture_two"]["tmp_name"])) {
        $urls = wp_handle_upload($_FILES["background_picture_two"], array('test_form' => FALSE));
        if( isset($urls["url"]) ) : 
            $temp = $urls["url"];
            return $temp;
        endif; 

        return $options; 
    }

    else {
        $urls = wp_handle_upload($_FILES["background_picture_two"], array('test_form' => FALSE));
        if( isset($urls["url"]) ) : 
            $temp = $urls["url"];
            return $temp;
        endif; 
        
        //no upload. old file url is the new value.
        return get_option('background_picture_two');
    }    
}

// Background two picture
function envy_chimp_background_two_form_element() { ?>
    <input type='file' name='background_picture_two' id='background_picture_two' />
    <?php echo get_option('background_picture_two');
}

/* ----------------------------------------------------------------------------- */
/* Field Callbacks 3 */
/* ----------------------------------------------------------------------------- */ 

// Enable form appearance
function envy_chimp_appearance_enable_callback() {
    $option_appearance_enable = (array)get_option('new_settings3');
    if( isset( $option_appearance_enable['option_appearance_enable'] ) ) :
        $option_appearance_enable_new = $option_appearance_enable['option_appearance_enable'];
    else:
        $option_appearance_enable_new = '';
    endif;
    echo __('<input type="checkbox" name="new_settings3[option_appearance_enable]" value="1" '.checked(1, $option_appearance_enable_new, false).' >', 'envy-chimp').__('Enable', 'envy-chimp');
}

// Form width
function envy_chimp_form_width_callback() {
    $envy_chimp_form_width = (array)get_option('new_settings3');
    if( isset($envy_chimp_form_width['option_form_width']) ) :
        $envy_chimp_form_width_new = $envy_chimp_form_width['option_form_width'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings3[option_form_width]'); ?>" value="<?php if( isset( $envy_chimp_form_width_new ) ) : echo esc_attr( $envy_chimp_form_width_new ); else : echo esc_html__('auto', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Form height
function envy_chimp_form_height_callback() {
    $envy_chimp_form_height = (array)get_option('new_settings3');
    if( isset($envy_chimp_form_height['option_form_height']) ) :
        $envy_chimp_form_height_new = $envy_chimp_form_height['option_form_height'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings3[option_form_height]'); ?>" value="<?php if( isset( $envy_chimp_form_height_new ) ) : echo esc_attr( $envy_chimp_form_height_new ); else : echo esc_html__('auto', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Form background color
function envy_chimp_form_bg_color_callback() {
    $envy_chimp_form_bg_color = (array)get_option('new_settings3');
    if( isset($envy_chimp_form_bg_color['option_form_bg_color']) ) :
        $envy_chimp_form_bg_color_new = $envy_chimp_form_bg_color['option_form_bg_color'];
    endif; ?>
    <input type="color" name="<?php echo esc_attr('new_settings3[option_form_bg_color]'); ?>" value="<?php if( isset( $envy_chimp_form_bg_color_new ) ) : echo esc_attr( $envy_chimp_form_bg_color_new ); else : echo esc_html__('#FFFFFF', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Input field background color
function envy_chimp_input_field_bg_color_callback() {
    $envy_chimp_input_field_bg_color = (array)get_option('new_settings3');
    if( isset($envy_chimp_input_field_bg_color['option_input_field_bg_color']) ) :
        $envy_chimp_input_field_bg_color_new = $envy_chimp_input_field_bg_color['option_input_field_bg_color'];
    endif; ?>
    <input type="color" name="<?php echo esc_attr('new_settings3[option_input_field_bg_color]'); ?>" value="<?php if( isset( $envy_chimp_input_field_bg_color_new ) ) : echo esc_attr( $envy_chimp_input_field_bg_color_new ); else : echo esc_html__('#FFFFFF', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Input field border
function envy_chimp_input_field_border_callback() {
    $envy_chimp_input_field_border = (array)get_option('new_settings3');
    if( isset($envy_chimp_input_field_border['option_input_field_border']) ) :
        $envy_chimp_input_field_border_new = $envy_chimp_input_field_border['option_input_field_border'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings3[option_input_field_border]'); ?>" value="<?php if( isset( $envy_chimp_input_field_border_new ) ) : echo esc_attr( $envy_chimp_input_field_border_new ); else : echo esc_html__('1px solid #ccc', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Input field border radius
function envy_chimp_input_field_border_radius_callback() {
    $envy_chimp_input_field_border_radius = (array)get_option('new_settings3');
    if( isset($envy_chimp_input_field_border_radius['option_input_field_border_radius']) ) :
        $envy_chimp_input_field_border_radius_new = $envy_chimp_input_field_border_radius['option_input_field_border_radius'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings3[option_input_field_border_radius]'); ?>" value="<?php if( isset( $envy_chimp_input_field_border_radius_new ) ) : echo esc_attr( $envy_chimp_input_field_border_radius_new ); else : echo esc_html__('0px', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Input field width
function envy_chimp_input_field_width_callback() {
    $envy_chimp_input_field_width = (array)get_option('new_settings3');
    if( isset($envy_chimp_input_field_width['option_input_field_width']) ) :
        $envy_chimp_input_field_width_new = $envy_chimp_input_field_width['option_input_field_width'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings3[option_input_field_width]'); ?>" value="<?php if( isset( $envy_chimp_input_field_width_new ) ) : echo esc_attr( $envy_chimp_input_field_width_new ); else : echo esc_html__('100%', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Input field padding
function envy_chimp_input_field_padding_callback() {
    $envy_chimp_input_field_padding = (array)get_option('new_settings3');
    if( isset($envy_chimp_input_field_padding['option_input_field_padding']) ) :
        $envy_chimp_input_field_padding_new = $envy_chimp_input_field_padding['option_input_field_padding'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings3[option_input_field_padding]'); ?>" value="<?php if( isset( $envy_chimp_input_field_padding_new ) ) : echo esc_attr( $envy_chimp_input_field_padding_new ); else : echo esc_html__('12px', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Button font size
function envy_chimp_submit_btn_font_size_callback() {
    $envy_chimp_submit_btn_font_size = (array)get_option('new_settings3');
    if( isset($envy_chimp_submit_btn_font_size['option_submit_btn_font_size']) ) :
        $envy_chimp_submit_btn_font_size_new = $envy_chimp_submit_btn_font_size['option_submit_btn_font_size'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings3[option_submit_btn_font_size]'); ?>" value="<?php if( isset( $envy_chimp_submit_btn_font_size_new ) ) : echo esc_attr( $envy_chimp_submit_btn_font_size_new ); else : echo esc_html__('16px', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Button background color
function envy_chimp_submit_btn_bg_color_callback() {
    $envy_chimp_submit_btn_bg_color = (array)get_option('new_settings3');
    if( isset($envy_chimp_submit_btn_bg_color['option_submit_btn_bg_color']) ) :
        $envy_chimp_submit_btn_bg_color_new = $envy_chimp_submit_btn_bg_color['option_submit_btn_bg_color'];
    endif; ?>
    <input type="color" name="<?php echo esc_attr('new_settings3[option_submit_btn_bg_color]'); ?>" value="<?php if( isset( $envy_chimp_submit_btn_bg_color_new ) ) : echo esc_attr( $envy_chimp_submit_btn_bg_color_new ); else : echo esc_html__('#150485', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Button background hover color
function envy_chimp_submit_btn_bg_hover_color_callback() {
    $envy_chimp_submit_btn_bg_hover_color = (array)get_option('new_settings3');
    if( isset($envy_chimp_submit_btn_bg_hover_color['option_submit_btn_bg_hover_color']) ) :
        $envy_chimp_submit_btn_bg_hover_color_new = $envy_chimp_submit_btn_bg_hover_color['option_submit_btn_bg_hover_color'];
    endif; ?>
    <input type="color" name="<?php echo esc_attr('new_settings3[option_submit_btn_bg_hover_color]'); ?>" value="<?php if( isset( $envy_chimp_submit_btn_bg_hover_color_new ) ) : echo esc_attr( $envy_chimp_submit_btn_bg_hover_color_new ); else : echo esc_html__('#000000', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Button font color
function envy_chimp_submit_btn_font_color_callback() {
    $envy_chimp_submit_btn_font_color = (array)get_option('new_settings3');
    if( isset($envy_chimp_submit_btn_font_color['option_submit_btn_font_color']) ) :
        $envy_chimp_submit_btn_font_color_new = $envy_chimp_submit_btn_font_color['option_submit_btn_font_color'];
    endif; ?>
    <input type="color" name="<?php echo esc_attr('new_settings3[option_submit_btn_font_color]'); ?>" value="<?php if( isset( $envy_chimp_submit_btn_font_color_new ) ) : echo esc_attr( $envy_chimp_submit_btn_font_color_new ); else : echo esc_html__('#FFFFFF', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

/* ----------------------------------------------------------------------------- */
/* Field Callbacks 4 */
/* ----------------------------------------------------------------------------- */ 

// Enable social media
function envy_chimp_social_enable_callback() {
    $option_social_enable = (array)get_option('new_settings4');
    if( isset( $option_social_enable['option_social_enable'] ) ) :
        $option_social_enable_new = $option_social_enable['option_social_enable'];
    else:
        $option_social_enable_new = '';
    endif;
    echo __('<input type="checkbox" name="new_settings4[option_social_enable]" value="1" '.checked(1, $option_social_enable_new, false).' >', 'envy-chimp').__('Enable', 'envy-chimp');
}

// Social title
function envy_chimp_social_title_callback() {
    $envy_chimp_social_title = (array)get_option('new_settings4');
    if( isset($envy_chimp_social_title['option_social_title']) ) :
        $envy_chimp_social_title_new = $envy_chimp_social_title['option_social_title'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings4[option_social_title]'); ?>" value="<?php if( isset( $envy_chimp_social_title_new ) ) : echo esc_attr( $envy_chimp_social_title_new ); else : echo esc_html__('Stay Connected', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Facebook link
function envy_chimp_social_fb_callback() {
    $envy_chimp_social_fb = (array)get_option('new_settings4');
    if( isset($envy_chimp_social_fb['option_social_fb']) ) :
        $envy_chimp_social_fb_new = $envy_chimp_social_fb['option_social_fb'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings4[option_social_fb]'); ?>" value="<?php if( isset( $envy_chimp_social_fb_new ) ) : echo esc_attr( $envy_chimp_social_fb_new ); else : echo esc_html__('#', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Twitter link
function envy_chimp_social_tw_callback() {
    $envy_chimp_social_tw = (array)get_option('new_settings4');
    if( isset($envy_chimp_social_tw['option_social_tw']) ) :
        $envy_chimp_social_tw_new = $envy_chimp_social_tw['option_social_tw'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings4[option_social_tw]'); ?>" value="<?php if( isset( $envy_chimp_social_tw_new ) ) : echo esc_attr( $envy_chimp_social_tw_new ); else : echo esc_html__('#', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Linkedin link
function envy_chimp_social_li_callback() {
    $envy_chimp_social_li = (array)get_option('new_settings4');
    if( isset($envy_chimp_social_li['option_social_li']) ) :
        $envy_chimp_social_li_new = $envy_chimp_social_li['option_social_li'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings4[option_social_li]'); ?>" value="<?php if( isset( $envy_chimp_social_li_new ) ) : echo esc_attr( $envy_chimp_social_li_new ); else : echo esc_html__('#', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Pinterest link
function envy_chimp_social_pi_callback() {
    $envy_chimp_social_pi = (array)get_option('new_settings4');
    if( isset($envy_chimp_social_pi['option_social_pi']) ) :
        $envy_chimp_social_pi_new = $envy_chimp_social_pi['option_social_pi'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings4[option_social_pi]'); ?>" value="<?php if( isset( $envy_chimp_social_pi_new ) ) : echo esc_attr( $envy_chimp_social_pi_new ); else : echo esc_html__('#', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }

// Youtube link
function envy_chimp_social_yt_callback() {
    $envy_chimp_social_yt = (array)get_option('new_settings4');
    if( isset($envy_chimp_social_yt['option_social_yt']) ) :
        $envy_chimp_social_yt_new = $envy_chimp_social_yt['option_social_yt'];
    endif; ?>
    <input type="text" name="<?php echo esc_attr('new_settings4[option_social_yt]'); ?>" value="<?php if( isset( $envy_chimp_social_yt_new ) ) : echo esc_attr( $envy_chimp_social_yt_new ); else : echo esc_html__('#', 'envy-chimp'); endif; ?>" class="regular-text">
<?php }


/* ----------------------------------------------------------------------------- */
/* Add Menu Page */
/* ----------------------------------------------------------------------------- */ 

function envy_chimp_menu() {
    add_menu_page ( __('EnvyChimp', 'envy-chimp'), __('EnvyChimp', 'envy-chimp'), 'manage_options', 'envy-chimp-plugin-options', 'envy_chimp_plugin_menu_page', 'dashicons-email-alt', '58' );
}
add_action('admin_menu', 'envy_chimp_menu');

function envy_chimp_plugin_menu_page() {
        ?>
        <?php  
        if( isset( $_GET[ 'tab' ] ) ) {  
            $active_tab = $_GET[ 'tab' ];  
        } else {
            $active_tab = 'tab_one';
        }
        ?>  
        <div class="wrap">
            <h2><?php echo esc_html__('EnvyChimp Plugin Options', 'envy-chimp'); ?></h2><br/>
            <h2><?php echo esc_html__('Use this shortcode [envy_chimp_subscribe_form] for show subscribe form', 'envy-chimp'); ?></h2>
            <h2><?php echo esc_html__('Use this shortcode [envy_chimp_signup_form] for show signup form', 'envy-chimp'); ?></h2>
            <h2><?php echo esc_html__('Use this shortcode [envy_chimp_login_form] for show login form', 'envy-chimp'); ?></h2>
            <h2><?php echo esc_html__('Use this shortcode [envy_chimp_login_signup_form] for show login & signup form', 'envy-chimp'); ?></h2><br/>
            <?php settings_errors(); ?> 
            <h2 class="nav-tab-wrapper">  
                <a href="?page=envy-chimp-plugin-options&tab=tab_one" class="nav-tab <?php echo $active_tab == 'tab_one' ? 'nav-tab-active' : ''; ?>"><?php echo esc_html__('General', 'envy-chimp'); ?></a>  
                <a href="?page=envy-chimp-plugin-options&tab=tab_two" class="nav-tab <?php echo $active_tab == 'tab_two' ? 'nav-tab-active' : ''; ?>"><?php echo esc_html__('Content', 'envy-chimp'); ?></a>
                <a href="?page=envy-chimp-plugin-options&tab=tab_three" class="nav-tab <?php echo $active_tab == 'tab_three' ? 'nav-tab-active' : ''; ?>"><?php echo esc_html__('Appearance', 'envy-chimp'); ?></a>
                <a href="?page=envy-chimp-plugin-options&tab=tab_four" class="nav-tab <?php echo $active_tab == 'tab_four' ? 'nav-tab-active' : ''; ?>"><?php echo esc_html__('Social Media', 'envy-chimp'); ?></a>  
            </h2> 
            <form method="post" action="options.php"> 
            <?php
                if( $active_tab == 'tab_one' ) {  
                    settings_fields( 'setting-group-1' );
                    do_settings_sections( 'envy-chimp-menu-slug-1' );
                } 
                else if( $active_tab == 'tab_two' )  {
                    settings_fields( 'setting-group-2' );
                    do_settings_sections( 'envy-chimp-menu-slug-2' );
                }
                else if( $active_tab == 'tab_three' )  {
                    settings_fields( 'setting-group-3' );
                    do_settings_sections( 'envy-chimp-menu-slug-3' );
                }
                else if( $active_tab == 'tab_four' )  {
                    settings_fields( 'setting-group-4' );
                    do_settings_sections( 'envy-chimp-menu-slug-4' );
                }
                submit_button(); ?> 
            </form> 
            <form method="post" action="options.php" enctype="multipart/form-data">
                <?php
                if( $active_tab == 'tab_two' ) {
                    settings_fields("image_section");                  
                    do_settings_sections("envy-chimp-image-options");               
                    submit_button(); 
                }                            
                ?>          
            </form>
            <form method="post" action="options.php" enctype="multipart/form-data">
                <?php
                if( $active_tab == 'tab_two' ) {
                    settings_fields("image_two_section");                  
                    do_settings_sections("envy-chimp-image-two-options");               
                    submit_button(); 
                }                            
                ?>          
            </form>
        </div>
    <?php
}
