<?php
function xs_form_shortcode($atts, $content){
	extract(shortcode_atts(array( 
		'class' => '',
		'id' => 'subs99'
	), $atts));

		static $form_number = 0;
		$form_number++;
		$form_id = 'ABss_form_' . $form_number;

$return = '<div class="ABss_form_wrapper '.$class.'" id='.$id.'>
<form id="' . $form_id . '" class="ABss_form '.$class.'" action="#" method="post">
	<div class="form-row">
		<input type="email" name="ABss_subscriber_email" id="emailSubscribe" class="form-control ABss_subscriber_email" placeholder="Enter Your Email Address Here...">
		<input type="submit" id="sub-submit" value="" class="">
		<input type="hidden" name="ajaxnonce" value="' . wp_create_nonce( $form_id ) . '">
		<input type="hidden" name="formno" value="' . $form_number . '">
	</div>
</form>
<div class="ABss_success_message"></div> </div>';

return $return;

}
add_shortcode( 'xs_subscribe_form', 'xs_form_shortcode');



function ABss_scripts() {
	wp_enqueue_style('ABss_form_style', plugins_url().'/xs-subscribe/css/xs-subscribe.css', false, '1.0.1');

	wp_enqueue_script( 'ABss_placeholder', plugins_url().'/xs-subscribe/js/jquery.placeholder.js', array('jquery'), '2.0.7', true);
	wp_enqueue_script( 'ABss_ajax_subscribe', plugins_url().'/xs-subscribe/js/xs-subscribe.js', array('jquery','ABss_placeholder'), '1.0.1', true);
	wp_localize_script( 'ABss_ajax_subscribe', 'ABss_custom', array( 
		'ajaxurl' => admin_url( 'admin-ajax.php' ),
		'success' => __('You have successfully subscribed. Thank you!', 'ABss'),
		'error' => __('Valid Email is Required', 'ABss'),
	));
}
add_action( 'wp_enqueue_scripts', 'ABss_scripts' );